主题
at
js
_.at(object, [paths])
创建与 object
的 paths
相对应的值数组。
¥Creates an array of values corresponding to paths
of object
.
新增于
¥Since
1.0.0
参数
¥Arguments
object
(对象):要迭代的对象。¥
object
(Object): The object to iterate over.[paths]
(...(字符串|字符串[])):要选择的属性路径。¥
[paths]
(...(string|string[])): The property paths to pick.
返回
¥Returns
(数组):返回选定的值。
¥(Array): Returns the picked values.
示例
¥Example
js
var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
_.at(object, ['a[0].b.c', 'a[1]']);
// => [3, 4]