mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-10 19:07:49 +00:00
Update vendors.
Former-commit-id: 44c2fe9fbfbf50aa64663d46b45d6fd2c778f2b7
This commit is contained in:
105
vendor/benchmark.js/benchmark.js
vendored
105
vendor/benchmark.js/benchmark.js
vendored
@@ -244,6 +244,36 @@
|
||||
} catch(e) {
|
||||
support.getAllKeys = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect if own properties are iterated before inherited properties (all but IE < 9).
|
||||
*
|
||||
* @name iteratesOwnLast
|
||||
* @memberOf Benchmark.support
|
||||
* @type Boolean
|
||||
*/
|
||||
support.iteratesOwnFirst = (function() {
|
||||
var props = [];
|
||||
function ctor() { this.x = 1; }
|
||||
ctor.prototype = { 'y': 1 };
|
||||
for (var prop in new ctor) { props.push(prop); }
|
||||
return props[0] == 'x';
|
||||
}());
|
||||
|
||||
/**
|
||||
* Detect if a node's [[Class]] is resolvable (all but IE < 9)
|
||||
* and that the JS engine errors when attempting to coerce an object to a
|
||||
* string without a `toString` property value of `typeof` "function".
|
||||
*
|
||||
* @name nodeClass
|
||||
* @memberOf Benchmark.support
|
||||
* @type Boolean
|
||||
*/
|
||||
try {
|
||||
support.nodeClass = ({ 'toString': 0 } + '', toString.call(doc || 0) != '[object Object]');
|
||||
} catch(e) {
|
||||
support.nodeClass = true;
|
||||
}
|
||||
}());
|
||||
|
||||
/**
|
||||
@@ -583,14 +613,17 @@
|
||||
while (++index < length) {
|
||||
if ((index - start) in tail) {
|
||||
object[index] = tail[index - start];
|
||||
} else {
|
||||
} else if (index in object) {
|
||||
delete object[index];
|
||||
}
|
||||
}
|
||||
// delete excess elements
|
||||
deleteCount = deleteCount > elementCount ? deleteCount - elementCount : 0;
|
||||
while (deleteCount--) {
|
||||
delete object[length + deleteCount];
|
||||
index = length + deleteCount;
|
||||
if (index in object) {
|
||||
delete object[index];
|
||||
}
|
||||
}
|
||||
object.length = length;
|
||||
return result;
|
||||
@@ -941,7 +974,13 @@
|
||||
// escape the `{` for Firefox 1
|
||||
result = (/^[^{]+\{([\s\S]*)}\s*$/.exec(fn) || 0)[1];
|
||||
}
|
||||
return (result || '').replace(/^\s+|\s+$/g, '');
|
||||
// trim string
|
||||
result = (result || '').replace(/^\s+|\s+$/g, '');
|
||||
|
||||
// detect strings containing only the "use strict" directive
|
||||
return /^(?:\/\*+[\w|\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(result)
|
||||
? ''
|
||||
: result;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -994,36 +1033,43 @@
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the specified `value` is an object created by the `Object`
|
||||
* constructor assuming objects created by the `Object` constructor have no
|
||||
* inherited enumerable properties and assuming there are no `Object.prototype`
|
||||
* extensions.
|
||||
* Checks if a given `value` is an object created by the `Object` constructor
|
||||
* assuming objects created by the `Object` constructor have no inherited
|
||||
* enumerable properties and that there are no `Object.prototype` extensions.
|
||||
*
|
||||
* @private
|
||||
* @param {Mixed} value The value to check.
|
||||
* @returns {Boolean} Returns `true` if `value` is an object, else `false`.
|
||||
* @returns {Boolean} Returns `true` if the `value` is a plain `Object` object, else `false`.
|
||||
*/
|
||||
function isObject(value) {
|
||||
var ctor,
|
||||
result = !!value && toString.call(value) == '[object Object]';
|
||||
|
||||
if (result && noArgumentsClass) {
|
||||
// avoid false positives for `arguments` objects in IE < 9
|
||||
result = !isArguments(value);
|
||||
function isPlainObject(value) {
|
||||
// avoid non-objects and false positives for `arguments` objects in IE < 9
|
||||
var result = false;
|
||||
if (!(value && typeof value == 'object') || (noArgumentsClass && isArguments(value))) {
|
||||
return result;
|
||||
}
|
||||
if (result) {
|
||||
// IE < 9 presents nodes like `Object` objects:
|
||||
// IE < 8 are missing the node's constructor property
|
||||
// IE 8 node constructors are typeof "object"
|
||||
ctor = value.constructor;
|
||||
// check if the constructor is `Object` as `Object instanceof Object` is `true`
|
||||
if ((result = isClassOf(ctor, 'Function') && ctor instanceof ctor)) {
|
||||
// An object's own properties are iterated before inherited properties.
|
||||
// If the last iterated key belongs to an object's own property then
|
||||
// there are no inherited enumerable properties.
|
||||
forProps(value, function(subValue, subKey) { result = subKey; });
|
||||
result = result === true || hasKey(value, result);
|
||||
// IE < 9 presents DOM nodes as `Object` objects except they have `toString`
|
||||
// methods that are `typeof` "string" and still can coerce nodes to strings.
|
||||
// Also check that the constructor is `Object` (i.e. `Object instanceof Object`)
|
||||
var ctor = value.constructor;
|
||||
if ((support.nodeClass || !(typeof value.toString != 'function' && typeof (value + '') == 'string')) &&
|
||||
(!isClassOf(ctor, 'Function') || ctor instanceof ctor)) {
|
||||
// In most environments an object's own properties are iterated before
|
||||
// its inherited properties. If the last iterated property is an object's
|
||||
// own property then there are no inherited enumerable properties.
|
||||
if (support.iteratesOwnFirst) {
|
||||
forProps(value, function(subValue, subKey) {
|
||||
result = subKey;
|
||||
});
|
||||
return result === false || hasKey(value, result);
|
||||
}
|
||||
// IE < 9 iterates inherited properties before own properties. If the first
|
||||
// iterated property is an object's own property then there are no inherited
|
||||
// enumerable properties.
|
||||
forProps(value, function(subValue, subKey) {
|
||||
result = !hasKey(value, subKey);
|
||||
return false;
|
||||
});
|
||||
return result === false;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -1265,7 +1311,7 @@
|
||||
break;
|
||||
|
||||
case '[object Object]':
|
||||
isObject(value) && (clone = new ctor);
|
||||
isPlainObject(value) && (clone = {});
|
||||
break;
|
||||
|
||||
case '[object Number]':
|
||||
@@ -2405,7 +2451,7 @@
|
||||
|
||||
var source = {
|
||||
'setup': getSource(bench.setup, preprocess('m$.setup()')),
|
||||
'fn': getSource(fn, preprocess('f$(' + fnArg + ')')),
|
||||
'fn': getSource(fn, preprocess('m$.fn(' + fnArg + ')')),
|
||||
'fnArg': fnArg,
|
||||
'teardown': getSource(bench.teardown, preprocess('m$.teardown()'))
|
||||
};
|
||||
@@ -3045,6 +3091,7 @@
|
||||
|
||||
/**
|
||||
* The maximum time a benchmark is allowed to run before finishing (secs).
|
||||
*
|
||||
* Note: Cycle delays aren't counted toward the maximum time.
|
||||
*
|
||||
* @memberOf Benchmark.options
|
||||
|
||||
Reference in New Issue
Block a user