Lodash教程

Lodash unzip method

语法:

_.unzip(array)
This method is like _.zip except that it accepts an array of grouped elements and creates an array regrouping the elements to their pre-zip configuration.

参数

array (Array) − The array of grouped elements to process.

输出:

(Array) − Returns the new array of regrouped elements.

实例:

var _ = require('lodash');
var result = _.zip(['a', 'b'], [1, 2], [true, false]);
console.log(result);
result = _.unzip(result);
console.log(result);
Save the above program in tester.js. Run the following command to execute this program.

命令:

\>node tester.js

输出:

[ [ 'a', 1, true ], [ 'b', 2, false ] ]
[ [ 'a', 'b' ], [ 1, 2 ], [ true, false ] ]
昵称: 邮箱:
Copyright © 2022 立地货 All Rights Reserved.
备案号:京ICP备14037608号-4