isObject.cjs 797 B

12345678910111213141516171819202122232425262728293031
  1. "use strict";
  2. // @ts-nocheck
  3. Object.defineProperty(exports, "__esModule", { value: true });
  4. /**
  5. * Checks if `value` is the
  6. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  7. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  8. *
  9. * @since 0.1.0
  10. * @category Lang
  11. * @param {*} value The value to check.
  12. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  13. * @example
  14. *
  15. * isObject({})
  16. * // => true
  17. *
  18. * isObject([1, 2, 3])
  19. * // => true
  20. *
  21. * isObject(Function)
  22. * // => true
  23. *
  24. * isObject(null)
  25. * // => false
  26. */
  27. function isObject(value) {
  28. const type = typeof value;
  29. return value != null && (type === "object" || type === "function");
  30. }
  31. exports.default = isObject;