index.d.ts 567 B

1234567891011121314151617181920212223242526272829
  1. /**
  2. Check if a value is a plain object.
  3. An object is plain if it's created by either `{}`, `new Object()`, or `Object.create(null)`.
  4. @example
  5. ```
  6. import isPlainObject = require('is-plain-obj');
  7. isPlainObject({foo: 'bar'});
  8. //=> true
  9. isPlainObject(new Object());
  10. //=> true
  11. isPlainObject(Object.create(null));
  12. //=> true
  13. isPlainObject([1, 2, 3]);
  14. //=> false
  15. class Unicorn {}
  16. isPlainObject(new Unicorn());
  17. //=> false
  18. ```
  19. */
  20. declare function isPlainObject<Value = unknown>(value: unknown): value is Record<string | number | symbol, Value>;
  21. export = isPlainObject;