| 595 | ): value is Record<T[number], any>; |
| 596 | export function isRecord(value: unknown): value is Record<string, any>; |
| 597 | export function isRecord( |
| 598 | value: unknown, |
| 599 | requiredKeys: string[] | undefined = undefined |
| 600 | ): value is Record<string, any> { |
| 601 | if (!isObject(value)) { |
| 602 | return false; |
| 603 | } |
| 604 | |
| 605 | const ctor = (value as any).constructor; |
| 606 | if (ctor && ctor.prototype) { |
| 607 | if (!isObject(ctor.prototype)) { |
| 608 | return false; |
| 609 | } |
| 610 | |
| 611 | // Check to see if some method exists from the Object exists |
| 612 | if (!HAS_OWN(ctor.prototype, 'isPrototypeOf')) { |
| 613 | return false; |
| 614 | } |
| 615 | } |
| 616 | |
| 617 | if (requiredKeys) { |
| 618 | const keys = Object.keys(value as Record<string, any>); |
| 619 | return isSuperset(keys, requiredKeys); |
| 620 | } |
| 621 | |
| 622 | return true; |
| 623 | } |
| 624 | |
| 625 | type ListNode<T> = { |
| 626 | value: T; |