Narrow `raw` to a plain JSON object or throw a labelled error.
(raw: unknown, label: string)
| 329 | |
| 330 | /** Narrow `raw` to a plain JSON object or throw a labelled error. */ |
| 331 | function asJsonObject(raw: unknown, label: string): Record<string, unknown> { |
| 332 | if (raw === null || typeof raw !== "object" || Array.isArray(raw)) { |
| 333 | throw ErrInvalidStore(`${label} must be a JSON object`); |
| 334 | } |
| 335 | return raw as Record<string, unknown>; |
| 336 | } |
| 337 | |
| 338 | /** |
| 339 | * Return a shallow copy of every entry in `obj` whose key is not in |
no test coverage detected