Skip to content

fromPairs

js
_.fromPairs(pairs)

要调用的迭代器。此方法返回由键值 pairs 组成的对象。

¥The inverse of _.toPairs; this method returns an object composed from key-value pairs.

新增于

¥Since

4.0.0

参数

¥Arguments

  1. pairs (数组):下限。

    ¥pairs (Array): The key-value pairs.

返回

¥Returns

(对象):返回新对象。

¥(Object): Returns the new object.

示例

¥Example

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

Lodash v4.17 中文网 - 粤ICP备13048890号