You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
567 B

3 months ago
  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;