Decode the field-name component of a key produced by makeKey.
(key: string)
| 179 | |
| 180 | /** Decode the field-name component of a key produced by {@link makeKey}. */ |
| 181 | private keyFieldName(key: string): string | undefined { |
| 182 | try { |
| 183 | const parsed = JSON.parse(key) as unknown; |
| 184 | if (Array.isArray(parsed) && typeof parsed[0] === "string") { |
| 185 | return parsed[0]; |
| 186 | } |
| 187 | } catch { |
| 188 | // Keys are always produced by makeKey, so this is unreachable in |
| 189 | // practice; fall through to undefined defensively. |
| 190 | } |
| 191 | return undefined; |
| 192 | } |
| 193 | } |