Start sharing components as a team!Share components as a team!Join Bit to build your applications faster.Get Started Free

is-object

v4.17.15arrow_drop_down
v4.17.15
v4.17.11
STATUS
Passing
DOWNLOADS
4,642
LICENSE
MIT
VISIBILITY
Public
PUBLISHED
2 months ago
SIZE
N/A
Checks if `value` is the [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) of `Object`.
2 contributors
Install is-object as a package?
Copied
npm i @bit/lodash.lodash.is-object
Set Bit as a scoped registryLearn more
npm config set '@bit:registry' https://node.bit.dev
Files
isObject.js
29 Lines(5 sloc)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/**
 * Checks if `value` is the
 * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
 * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
 *
 * @since 0.1.0
 * @category Lang
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is an object, else `false`.
 * @example
 *
 * isObject({})
 * // => true
 *
 * isObject([1, 2, 3])
 * // => true
 *
 * isObject(Function)
 * // => true
 *
 * isObject(null)
 * // => false
 */
function isObject(value) {
  const type = typeof value
  return value != null && (type === 'object' || type === 'function')
}

export default isObject