(value: unknown)
| 1273 | } |
| 1274 | |
| 1275 | export const describeShape = (value: unknown): string => { |
| 1276 | if (!hasDomain(value, "object")) return describeValue(value) |
| 1277 | if (value instanceof Date) return `a Date at ${dateGetTime.call(value)}` |
| 1278 | if (value instanceof RegExp) return `the RegExp ${value}` |
| 1279 | if (Array.isArray(value)) return `an array of length ${value.length}` |
| 1280 | const prototype = prototypeOf(value) |
| 1281 | if (prototype !== Object.prototype && prototype !== null) |
| 1282 | return describeValue(value) |
| 1283 | const kind = prototype ? "object" : "null-prototype object" |
| 1284 | const keys = Reflect.ownKeys(value) |
| 1285 | return keys.length ? |
| 1286 | `${prototype ? "an" : "a"} ${kind} with keys ${keys.map(String).join(", ")}` |
| 1287 | : `an empty ${kind}` |
| 1288 | } |
| 1289 | |
| 1290 | /** |
| 1291 | * What a plain object or array of primitives holds, as 53 bits: what kind it |
nothing calls this directly
no test coverage detected