Lodash zipObjectDeep method
语法:
_.zipObjectDeep([props=[]], [values=[]])
This method is like _.zipObject except that it supports property paths.
参数
[props=[]] (Array) − The property identifiers.
[values=[]] (Array) − The property values.
输出:
(Object) − Returns the new object.
实例:
var _ = require('lodash');
var result = _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
console.log(result);
Save the above program in
tester.js. Run the following command to execute this program.
命令:
输出:
{ a: { b: [ [Object], [Object] ] } }