Add _.unzip. [closes #225]

Former-commit-id: 4b2c7fc068fd430f3d78de850a5f7670fd0e1a4e
This commit is contained in:
John-David Dalton
2013-04-02 22:34:15 -07:00
parent 265ca8ba67
commit e76360c1b5
6 changed files with 138 additions and 26 deletions

View File

@@ -487,6 +487,10 @@
var _findWhere = _.findWhere || _.find,\
lodashFindWhere = lodash.findWhere || lodash.find,\
whereObject = { "num": 9 };\
}\
if (typeof zip != "undefined") {\
var unzipped = [["a", "b", "c"], [1, 2, 3], [true, false, true]],\
zipped = [["a", 1, true], ["b", 2, false], ["c", 3, true]];\
}'
});
@@ -1752,6 +1756,20 @@
/*--------------------------------------------------------------------------*/
suites.push(
Benchmark.Suite('`_.unzip`')
.add(buildName, {
'fn': 'lodash.unzip(zipped);',
'teardown': 'function zip(){}'
})
.add(otherName, {
'fn': '_.unzip(zipped);',
'teardown': 'function zip(){}'
})
);
/*--------------------------------------------------------------------------*/
suites.push(
Benchmark.Suite('`_.values`')
.add(buildName, '\
@@ -1802,6 +1820,20 @@
/*--------------------------------------------------------------------------*/
suites.push(
Benchmark.Suite('`_.zip`')
.add(buildName, {
'fn': 'lodash.zip.apply(lodash, unzipped);',
'teardown': 'function zip(){}'
})
.add(otherName, {
'fn': '_.zip.apply(_, unzipped);',
'teardown': 'function zip(){}'
})
);
/*--------------------------------------------------------------------------*/
if (Benchmark.platform + '') {
log(Benchmark.platform);
}