Home

function: isEmpty


isEmpty(value: *): boolean

Checks if `value` is an empty object, collection, map, or set. Objects are considered empty if they have no own enumerable string keyed properties. Array-like values such as `arguments` objects, arrays, buffers, strings, or jQuery-like collections are considered empty if they have a `length` of `0`. Similarly, maps and sets are considered empty if they have a `size` of `0`.

Example(s):

isEmpty(null)
// => true

isEmpty(true)
// => true

isEmpty(1)
// => true

isEmpty([1, 2, 3])
// => false

isEmpty({ 'a': 1 })
// => false

Params:

Name Type Attribute Description
value The value to check.

Returns:

boolean

  {
    "comment": "/**\r\n * Checks if `value` is an empty object, collection, map, or set.\r\n *\r\n * Objects are considered empty if they have no own enumerable string keyed\r\n * properties.\r\n *\r\n * Array-like values such as `arguments` objects, arrays, buffers, strings, or\r\n * jQuery-like collections are considered empty if they have a `length` of `0`.\r\n * Similarly, maps and sets are considered empty if they have a `size` of `0`.\r\n *\r\n * @since 0.1.0\r\n * @category Lang\r\n * @param {*} value The value to check.\r\n * @returns {boolean} Returns `true` if `value` is empty, else `false`.\r\n * @example\r\n *\r\n * isEmpty(null)\r\n * // => true\r\n *\r\n * isEmpty(true)\r\n * // => true\r\n *\r\n * isEmpty(1)\r\n * // => true\r\n *\r\n * isEmpty([1, 2, 3])\r\n * // => false\r\n *\r\n * isEmpty({ 'a': 1 })\r\n * // => false\r\n */",
    "meta": {
        "range": [
            1209,
            1820
        ],
        "filename": "isEmpty.js",
        "lineno": 43,
        "path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\lodash\\lodash-repo",
        "code": {
            "id": "astnode100004500",
            "name": "isEmpty",
            "type": "FunctionDeclaration",
            "paramnames": [
                "value"
            ]
        },
        "vars": {
            "tag": "isEmpty~tag",
            "key": "isEmpty~key"
        }
    },
    "description": "Checks if `value` is an empty object, collection, map, or set.\r\rObjects are considered empty if they have no own enumerable string keyed\rproperties.\r\rArray-like values such as `arguments` objects, arrays, buffers, strings, or\rjQuery-like collections are considered empty if they have a `length` of `0`.\rSimilarly, maps and sets are considered empty if they have a `size` of `0`.",
    "since": "0.1.0",
    "tags": [
        {
            "originalTitle": "category",
            "title": "category",
            "text": "Lang",
            "value": "Lang"
        }
    ],
    "params": [
        {
            "type": {
                "names": [
                    "*"
                ]
            },
            "description": "The value to check.",
            "name": "value"
        }
    ],
    "returns": [
        {
            "type": {
                "names": [
                    "boolean"
                ]
            },
            "description": "Returns `true` if `value` is empty, else `false`."
        }
    ],
    "examples": [
        "isEmpty(null)\r// => true\r\risEmpty(true)\r// => true\r\risEmpty(1)\r// => true\r\risEmpty([1, 2, 3])\r// => false\r\risEmpty({ 'a': 1 })\r// => false"
    ],
    "name": "isEmpty",
    "longname": "isEmpty",
    "kind": "function",
    "scope": "global",
    "___id": "T000002R000443",
    "___s": true,
    "filepath": "isEmpty.js"
}