Lodash unzip method
语法:
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.
命令:
输出:
[ [ 'a', 1, true ], [ 'b', 2, false ] ]
[ [ 'a', 'b' ], [ 1, 2 ], [ true, false ] ]