Lodash教程

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.

命令:

\>node tester.js

输出:

{ a: { b: [ [Object], [Object] ] } }
昵称: 邮箱:
Copyright © 2022 立地货 All Rights Reserved.
备案号:京ICP备14037608号-4