8000 Make pref.'s work for various lodash builds. · lodash/lodash@3f7f813 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3f7f813

Browse files
committed
Make pref.'s work for various lodash builds.
Former-commit-id: cdde1730e7b402c1f6475fc796af683faf6a8e88
1 parent fef5e1c commit 3f7f813

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

perf/perf.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@
277277
}\
278278
}\
279279
if (typeof chaining != "undefined") {\
280-
var _chaining = _(numbers).chain(),\
280+
var _chaining = _.chain ? _(numbers).chain() : _(numbers),\
281281
lodashChaining = lodash(numbers);\
282282
}\
283283
if (typeof compact != "undefined") {\
@@ -477,14 +477,16 @@
477477
\
478478
var settingsObject = { "variable": "data" };\
479479
\
480-
var lodashTpl = lodash.template(tpl),\
481-
lodashTplVerbose = lodash.template(tplVerbose, null, settingsObject);\
482-
\
483480
var _tpl = _.template(tpl),\
484481
_tplVerbose = _.template(tplVerbose, null, settingsObject);\
482+
\
483+
var lodashTpl = lodash.template(tpl),\
484+
lodashTplVerbose = lodash.template(tplVerbose, null, settingsObject);\
485485
}\
486486
if (typeof where != "undefined") {\
487-
var whereObject = { "num": 9 };\
487+
var _findWhere = _.findWhere || _.find,\
488+
lodashFindWhere = lodash.findWhere || lodash.find,\
489+
whereObject = { "num": 9 };\
488490
}'
489491
});
490492

@@ -926,11 +928,11 @@
926928
suites.push(
927929
Benchmark.Suite('`_.find` with `properties`')
928930
.add(buildName, {
929-
'fn': 'lodash.find(objects, whereObject)',
931+
'fn': 'lodashFindWhere(objects, whereObject)',
930932
'teardown': 'function where(){}'
931933
})
932934
.add(otherName, {
933-
'fn': '_.findWhere(objects, whereObject)',
935+
'fn': '_findWhere(objects, whereObject)',
934936
'teardown': 'function where(){}'
935937
})
936938
);

0 commit comments

Comments
 (0)
0