mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-05 17:37:50 +00:00
replacing all isType tests that relied on string comparisons with versions that check for existence of known methods and properties. Less safe, but more than an order of magnitude faster.
This commit is contained in:
25
test/temp.js
Normal file
25
test/temp.js
Normal file
@@ -0,0 +1,25 @@
|
||||
(function() {
|
||||
|
||||
var func = function(){};
|
||||
var date = new Date();
|
||||
var str = "a string";
|
||||
var numbers = [];
|
||||
for (var i=0; i<1000; i++) numbers.push(i);
|
||||
var objects = _.map(numbers, function(n){ return {num : n}; });
|
||||
var randomized = _.sortBy(numbers, function(){ return Math.random(); });
|
||||
|
||||
JSLitmus.test('_.each()', function() {
|
||||
var timesTwo = [];
|
||||
_.each(numbers, function(num){ timesTwo.push(num * 2); });
|
||||
return timesTwo;
|
||||
});
|
||||
|
||||
JSLitmus.test('_.isString', function() {
|
||||
return _.isString(str);
|
||||
});
|
||||
|
||||
JSLitmus.test('_.isStringNew', function() {
|
||||
return _.isStringNew(str);
|
||||
});
|
||||
|
||||
})();
|
||||
Reference in New Issue
Block a user