Home

function: fromPairs


fromPairs(pairs: Array): Object

The inverse of `toPairs`is method returns an object composed from key-value `pairs`.

Example(s):

fromPairs([['a', 1], ['b', 2]])
// => { 'a': 1, 'b': 2 }

Params:

Name Type Attribute Description
pairs The key-value pairs.

Returns:

Object

  {
    "comment": "/**\r\n * The inverse of `toPairs`is method returns an object composed\r\n * from key-value `pairs`.\r\n *\r\n * @since 4.0.0\r\n * @category Array\r\n * @param {Array} pairs The key-value pairs.\r\n * @returns {Object} Returns the new object.\r\n * @example\r\n *\r\n * fromPairs([['a', 1], ['b', 2]])\r\n * // => { 'a': 1, 'b': 2 }\r\n */",
    "meta": {
        "range": [
            318,
            554
        ],
        "filename": "fromPairs.js",
        "lineno": 14,
        "path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\lodash\\lodash-repo",
        "code": {
            "id": "astnode100003025",
            "name": "fromPairs",
            "type": "FunctionDeclaration",
            "paramnames": [
                "pairs"
            ]
        },
        "vars": {
            "index": "fromPairs~index",
            "length": "fromPairs~length",
            "result": "fromPairs~result",
            "pair": "fromPairs~pair",
            "result[undefined]": "fromPairs~result.undefined]"
        }
    },
    "description": "The inverse of `toPairs`is method returns an object composed\rfrom key-value `pairs`.",
    "since": "4.0.0",
    "tags": [
        {
            "originalTitle": "category",
            "title": "category",
            "text": "Array",
            "value": "Array"
        }
    ],
    "params": [
        {
            "type": {
                "names": [
                    "Array"
                ]
            },
            "description": "The key-value pairs.",
            "name": "pairs"
        }
    ],
    "returns": [
        {
            "type": {
                "names": [
                    "Object"
                ]
            },
            "description": "Returns the new object."
        }
    ],
    "examples": [
        "fromPairs([['a', 1], ['b', 2]])\r// => { 'a': 1, 'b': 2 }"
    ],
    "name": "fromPairs",
    "longname": "fromPairs",
    "kind": "function",
    "scope": "global",
    "___id": "T000002R000321",
    "___s": true,
    "filepath": "fromPairs.js"
}