主题
toPairsIn
js
_.toPairsIn(object)
为 object
创建一个自己的和继承的可枚举字符串键值对数组,可由 _.fromPairs
使用。如果 object
是映射或集合,则返回其条目。
¥Creates an array of own and inherited enumerable string keyed-value pairs for object
which can be consumed by _.fromPairs
. If object
is a map or set, its entries are returned.
新增于
¥Since
4.0.0
别名
¥Aliases
_.entriesIn
参数
¥Arguments
object
(对象):的反面;¥
object
(Object): The object to query.
返回
¥Returns
(数组):返回键值对。
¥(Array): Returns the key-value pairs.
示例
¥Example
js
function Foo() {
this.a = 1;
this.b = 2;
}
Foo.prototype.c = 3;
_.toPairsIn(new Foo);
// => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)