mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-07 01:57:50 +00:00
More comment cleanup. [ci skip]
This commit is contained in:
157
lodash.js
157
lodash.js
@@ -8,13 +8,13 @@
|
|||||||
*/
|
*/
|
||||||
;(function() {
|
;(function() {
|
||||||
|
|
||||||
/** Used as a safe reference for `undefined` in pre ES5 environments */
|
/** Used as a safe reference for `undefined` in pre ES5 environments. */
|
||||||
var undefined;
|
var undefined;
|
||||||
|
|
||||||
/** Used as the semantic version number */
|
/** Used as the semantic version number. */
|
||||||
var VERSION = '3.0.0-pre';
|
var VERSION = '3.0.0-pre';
|
||||||
|
|
||||||
/** Used to compose bitmasks for wrapper metadata */
|
/** Used to compose bitmasks for wrapper metadata. */
|
||||||
var BIND_FLAG = 1,
|
var BIND_FLAG = 1,
|
||||||
BIND_KEY_FLAG = 2,
|
BIND_KEY_FLAG = 2,
|
||||||
CURRY_FLAG = 4,
|
CURRY_FLAG = 4,
|
||||||
@@ -24,38 +24,38 @@
|
|||||||
PARTIAL_RIGHT_FLAG = 64,
|
PARTIAL_RIGHT_FLAG = 64,
|
||||||
REARG_FLAG = 128;
|
REARG_FLAG = 128;
|
||||||
|
|
||||||
/** Used as default options for `_.trunc` */
|
/** Used as default options for `_.trunc`. */
|
||||||
var DEFAULT_TRUNC_LENGTH = 30,
|
var DEFAULT_TRUNC_LENGTH = 30,
|
||||||
DEFAULT_TRUNC_OMISSION = '...';
|
DEFAULT_TRUNC_OMISSION = '...';
|
||||||
|
|
||||||
/** Used to detect when a function becomes hot */
|
/** Used to detect when a function becomes hot. */
|
||||||
var HOT_COUNT = 150,
|
var HOT_COUNT = 150,
|
||||||
HOT_SPAN = 16;
|
HOT_SPAN = 16;
|
||||||
|
|
||||||
/** Used to indicate the type of lazy iteratees */
|
/** Used to indicate the type of lazy iteratees. */
|
||||||
var LAZY_FILTER_FLAG = 0,
|
var LAZY_FILTER_FLAG = 0,
|
||||||
LAZY_MAP_FLAG = 1,
|
LAZY_MAP_FLAG = 1,
|
||||||
LAZY_WHILE_FLAG = 2;
|
LAZY_WHILE_FLAG = 2;
|
||||||
|
|
||||||
/** Used as the `TypeError` message for "Functions" methods */
|
/** Used as the `TypeError` message for "Functions" methods. */
|
||||||
var FUNC_ERROR_TEXT = 'Expected a function';
|
var FUNC_ERROR_TEXT = 'Expected a function';
|
||||||
|
|
||||||
/** Used as the internal argument placeholder */
|
/** Used as the internal argument placeholder. */
|
||||||
var PLACEHOLDER = '__lodash_placeholder__';
|
var PLACEHOLDER = '__lodash_placeholder__';
|
||||||
|
|
||||||
/** Used to generate unique IDs */
|
/** Used to generate unique IDs. */
|
||||||
var idCounter = 0;
|
var idCounter = 0;
|
||||||
|
|
||||||
/** Used to match empty string literals in compiled template source */
|
/** Used to match empty string literals in compiled template source. */
|
||||||
var reEmptyStringLeading = /\b__p \+= '';/g,
|
var reEmptyStringLeading = /\b__p \+= '';/g,
|
||||||
reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
|
reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
|
||||||
reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
|
reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
|
||||||
|
|
||||||
/** Used to match HTML entities and HTML characters */
|
/** Used to match HTML entities and HTML characters. */
|
||||||
var reEscapedHtml = /&(?:amp|lt|gt|quot|#39|#96);/g,
|
var reEscapedHtml = /&(?:amp|lt|gt|quot|#39|#96);/g,
|
||||||
reUnescapedHtml = /[&<>"'`]/g;
|
reUnescapedHtml = /[&<>"'`]/g;
|
||||||
|
|
||||||
/** Used to match template delimiters */
|
/** Used to match template delimiters. */
|
||||||
var reEscape = /<%-([\s\S]+?)%>/g,
|
var reEscape = /<%-([\s\S]+?)%>/g,
|
||||||
reEvaluate = /<%([\s\S]+?)%>/g,
|
reEvaluate = /<%([\s\S]+?)%>/g,
|
||||||
reInterpolate = /<%=([\s\S]+?)%>/g;
|
reInterpolate = /<%=([\s\S]+?)%>/g;
|
||||||
@@ -67,22 +67,22 @@
|
|||||||
*/
|
*/
|
||||||
var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
|
var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
|
||||||
|
|
||||||
/** Used to match `RegExp` flags from their coerced string values */
|
/** Used to match `RegExp` flags from their coerced string values. */
|
||||||
var reFlags = /\w*$/;
|
var reFlags = /\w*$/;
|
||||||
|
|
||||||
/** Used to detect named functions */
|
/** Used to detect named functions. */
|
||||||
var reFuncName = /^\s*function[ \n\r\t]+\w/;
|
var reFuncName = /^\s*function[ \n\r\t]+\w/;
|
||||||
|
|
||||||
/** Used to detect hexadecimal string values */
|
/** Used to detect hexadecimal string values. */
|
||||||
var reHexPrefix = /^0[xX]/;
|
var reHexPrefix = /^0[xX]/;
|
||||||
|
|
||||||
/** Used to detect host constructors (Safari > 5) */
|
/** Used to detect host constructors (Safari > 5). */
|
||||||
var reHostCtor = /^\[object .+?Constructor\]$/;
|
var reHostCtor = /^\[object .+?Constructor\]$/;
|
||||||
|
|
||||||
/** Used to match latin-1 supplement letters (excluding mathematical operators) */
|
/** Used to match latin-1 supplement letters (excluding mathematical operators). */
|
||||||
var reLatin1 = /[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g;
|
var reLatin1 = /[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g;
|
||||||
|
|
||||||
/** Used to ensure capturing order of template delimiters */
|
/** Used to ensure capturing order of template delimiters. */
|
||||||
var reNoMatch = /($^)/;
|
var reNoMatch = /($^)/;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -92,13 +92,13 @@
|
|||||||
*/
|
*/
|
||||||
var reRegExpChars = /[.*+?^${}()|[\]\/\\]/g;
|
var reRegExpChars = /[.*+?^${}()|[\]\/\\]/g;
|
||||||
|
|
||||||
/** Used to detect functions containing a `this` reference */
|
/** Used to detect functions containing a `this` reference. */
|
||||||
var reThis = /\bthis\b/;
|
var reThis = /\bthis\b/;
|
||||||
|
|
||||||
/** Used to match unescaped characters in compiled string literals */
|
/** Used to match unescaped characters in compiled string literals. */
|
||||||
var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
|
var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
|
||||||
|
|
||||||
/** Used to match words to create compound words */
|
/** Used to match words to create compound words. */
|
||||||
var reWords = (function() {
|
var reWords = (function() {
|
||||||
var upper = '[A-Z\\xc0-\\xd6\\xd8-\\xde]',
|
var upper = '[A-Z\\xc0-\\xd6\\xd8-\\xde]',
|
||||||
lower = '[a-z\\xdf-\\xf6\\xf8-\\xff]+';
|
lower = '[a-z\\xdf-\\xf6\\xf8-\\xff]+';
|
||||||
@@ -106,19 +106,19 @@
|
|||||||
return RegExp(upper + '{2,}(?=' + upper + lower + ')|' + upper + '?' + lower + '|' + upper + '+|[0-9]+', 'g');
|
return RegExp(upper + '{2,}(?=' + upper + lower + ')|' + upper + '?' + lower + '|' + upper + '+|[0-9]+', 'g');
|
||||||
}());
|
}());
|
||||||
|
|
||||||
/** Used to detect and test whitespace */
|
/** Used to detect and test for whitespace. */
|
||||||
var whitespace = (
|
var whitespace = (
|
||||||
// whitespace
|
// Basic whitespace characters.
|
||||||
' \t\x0b\f\xa0\ufeff' +
|
' \t\x0b\f\xa0\ufeff' +
|
||||||
|
|
||||||
// line terminators
|
// Line terminators.
|
||||||
'\n\r\u2028\u2029' +
|
'\n\r\u2028\u2029' +
|
||||||
|
|
||||||
// unicode category "Zs" space separators
|
// Unicode category "Zs" space separators.
|
||||||
'\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000'
|
'\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000'
|
||||||
);
|
);
|
||||||
|
|
||||||
/** Used to assign default `context` object properties */
|
/** Used to assign default `context` object properties. */
|
||||||
var contextProps = [
|
var contextProps = [
|
||||||
'Array', 'ArrayBuffer', 'Date', 'Error', 'Float32Array', 'Float64Array',
|
'Array', 'ArrayBuffer', 'Date', 'Error', 'Float32Array', 'Float64Array',
|
||||||
'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Math', 'Number',
|
'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Math', 'Number',
|
||||||
@@ -128,16 +128,16 @@
|
|||||||
'window', 'WinRTError'
|
'window', 'WinRTError'
|
||||||
];
|
];
|
||||||
|
|
||||||
/** Used to fix the JScript `[[DontEnum]]` bug */
|
/** Used to fix the JScript `[[DontEnum]]` bug. */
|
||||||
var shadowedProps = [
|
var shadowedProps = [
|
||||||
'constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable',
|
'constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable',
|
||||||
'toLocaleString', 'toString', 'valueOf'
|
'toLocaleString', 'toString', 'valueOf'
|
||||||
];
|
];
|
||||||
|
|
||||||
/** Used to make template sourceURLs easier to identify */
|
/** Used to make template sourceURLs easier to identify. */
|
||||||
var templateCounter = -1;
|
var templateCounter = -1;
|
||||||
|
|
||||||
/** `Object#toString` result references */
|
/** `Object#toString` result references. */
|
||||||
var argsClass = '[object Arguments]',
|
var argsClass = '[object Arguments]',
|
||||||
arrayClass = '[object Array]',
|
arrayClass = '[object Array]',
|
||||||
boolClass = '[object Boolean]',
|
boolClass = '[object Boolean]',
|
||||||
@@ -163,7 +163,7 @@
|
|||||||
uint16Class = '[object Uint16Array]',
|
uint16Class = '[object Uint16Array]',
|
||||||
uint32Class = '[object Uint32Array]';
|
uint32Class = '[object Uint32Array]';
|
||||||
|
|
||||||
/** Used to identify object classifications that are treated like arrays */
|
/** Used to identify object classifications that are treated like arrays. */
|
||||||
var arrayLikeClasses = {};
|
var arrayLikeClasses = {};
|
||||||
arrayLikeClasses[argsClass] =
|
arrayLikeClasses[argsClass] =
|
||||||
arrayLikeClasses[arrayClass] = arrayLikeClasses[float32Class] =
|
arrayLikeClasses[arrayClass] = arrayLikeClasses[float32Class] =
|
||||||
@@ -178,7 +178,7 @@
|
|||||||
arrayLikeClasses[regexpClass] = arrayLikeClasses[setClass] =
|
arrayLikeClasses[regexpClass] = arrayLikeClasses[setClass] =
|
||||||
arrayLikeClasses[stringClass] = arrayLikeClasses[weakMapClass] = false;
|
arrayLikeClasses[stringClass] = arrayLikeClasses[weakMapClass] = false;
|
||||||
|
|
||||||
/** Used to identify object classifications that `_.clone` supports */
|
/** Used to identify object classifications that `_.clone` supports. */
|
||||||
var cloneableClasses = {};
|
var cloneableClasses = {};
|
||||||
cloneableClasses[argsClass] = cloneableClasses[arrayClass] =
|
cloneableClasses[argsClass] = cloneableClasses[arrayClass] =
|
||||||
cloneableClasses[arrayBufferClass] = cloneableClasses[boolClass] =
|
cloneableClasses[arrayBufferClass] = cloneableClasses[boolClass] =
|
||||||
@@ -193,14 +193,14 @@
|
|||||||
cloneableClasses[funcClass] = cloneableClasses[mapClass] =
|
cloneableClasses[funcClass] = cloneableClasses[mapClass] =
|
||||||
cloneableClasses[setClass] = cloneableClasses[weakMapClass] = false;
|
cloneableClasses[setClass] = cloneableClasses[weakMapClass] = false;
|
||||||
|
|
||||||
/** Used as an internal `_.debounce` options object by `_.throttle` */
|
/** Used as an internal `_.debounce` options object by `_.throttle`. */
|
||||||
var debounceOptions = {
|
var debounceOptions = {
|
||||||
'leading': false,
|
'leading': false,
|
||||||
'maxWait': 0,
|
'maxWait': 0,
|
||||||
'trailing': false
|
'trailing': false
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Used to map latin-1 supplementary letters to basic latin letters */
|
/** Used to map latin-1 supplementary letters to basic latin letters. */
|
||||||
var deburredLetters = {
|
var deburredLetters = {
|
||||||
'\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
|
'\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
|
||||||
'\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
|
'\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
|
||||||
@@ -221,20 +221,7 @@
|
|||||||
'\xdf': 'ss'
|
'\xdf': 'ss'
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/** Used to map characters to HTML entities. */
|
||||||
* Used to map characters to HTML entities.
|
|
||||||
*
|
|
||||||
* **Note:** Though the ">" character is escaped for symmetry, characters like
|
|
||||||
* ">" and "/" don't require escaping in HTML and have no special meaning
|
|
||||||
* unless they're part of a tag or unquoted attribute value.
|
|
||||||
* See [Mathias Bynens's article](http://mathiasbynens.be/notes/ambiguous-ampersands)
|
|
||||||
* (under "semi-related fun fact") for more details.
|
|
||||||
*
|
|
||||||
* Backticks are escaped because in Internet Explorer < 9, they can break out
|
|
||||||
* of attribute values or HTML comments. See [#102](http://html5sec.org/#102),
|
|
||||||
* [#108](http://html5sec.org/#108), and [#133](http://html5sec.org/#133) of
|
|
||||||
* the [HTML5 Security Cheatsheet](http://html5sec.org/) for more details.
|
|
||||||
*/
|
|
||||||
var htmlEscapes = {
|
var htmlEscapes = {
|
||||||
'&': '&',
|
'&': '&',
|
||||||
'<': '<',
|
'<': '<',
|
||||||
@@ -244,7 +231,7 @@
|
|||||||
'`': '`'
|
'`': '`'
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Used to map HTML entities to characters */
|
/** Used to map HTML entities to characters. */
|
||||||
var htmlUnescapes = {
|
var htmlUnescapes = {
|
||||||
'&': '&',
|
'&': '&',
|
||||||
'<': '<',
|
'<': '<',
|
||||||
@@ -254,13 +241,13 @@
|
|||||||
'`': '`'
|
'`': '`'
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Used to determine if values are of the language type `Object` */
|
/** Used to determine if values are of the language type `Object`. */
|
||||||
var objectTypes = {
|
var objectTypes = {
|
||||||
'function': true,
|
'function': true,
|
||||||
'object': true
|
'object': true
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Used to escape characters for inclusion in compiled string literals */
|
/** Used to escape characters for inclusion in compiled string literals. */
|
||||||
var stringEscapes = {
|
var stringEscapes = {
|
||||||
'\\': '\\',
|
'\\': '\\',
|
||||||
"'": "'",
|
"'": "'",
|
||||||
@@ -278,19 +265,19 @@
|
|||||||
*/
|
*/
|
||||||
var root = (objectTypes[typeof window] && window !== (this && this.window)) ? window : this;
|
var root = (objectTypes[typeof window] && window !== (this && this.window)) ? window : this;
|
||||||
|
|
||||||
/** Detect free variable `exports` */
|
/** Detect free variable `exports`. */
|
||||||
var freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports;
|
var freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports;
|
||||||
|
|
||||||
/** Detect free variable `module` */
|
/** Detect free variable `module`. */
|
||||||
var freeModule = objectTypes[typeof module] && module && !module.nodeType && module;
|
var freeModule = objectTypes[typeof module] && module && !module.nodeType && module;
|
||||||
|
|
||||||
/** Detect free variable `global` from Node.js or Browserified code and use it as `root` */
|
/** Detect free variable `global` from Node.js or Browserified code and use it as `root`. */
|
||||||
var freeGlobal = freeExports && freeModule && typeof global == 'object' && global;
|
var freeGlobal = freeExports && freeModule && typeof global == 'object' && global;
|
||||||
if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal)) {
|
if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal)) {
|
||||||
root = freeGlobal;
|
root = freeGlobal;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Detect the popular CommonJS extension `module.exports` */
|
/** Detect the popular CommonJS extension `module.exports`. */
|
||||||
var moduleExports = freeModule && freeModule.exports === freeExports && freeExports;
|
var moduleExports = freeModule && freeModule.exports === freeExports && freeExports;
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
@@ -586,7 +573,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used by `_.sortBy` to compare transformed elements of `collection` and stable
|
* Used by `_.sortBy` to compare transformed elements of a collection and stable
|
||||||
* sort them in ascending order.
|
* sort them in ascending order.
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
@@ -861,7 +848,7 @@
|
|||||||
// See http://es5.github.io/#x11.1.5.
|
// See http://es5.github.io/#x11.1.5.
|
||||||
context = context ? _.defaults(root.Object(), context, _.pick(root, contextProps)) : root;
|
context = context ? _.defaults(root.Object(), context, _.pick(root, contextProps)) : root;
|
||||||
|
|
||||||
/** Native constructor references */
|
/** Native constructor references. */
|
||||||
var Array = context.Array,
|
var Array = context.Array,
|
||||||
Date = context.Date,
|
Date = context.Date,
|
||||||
Error = context.Error,
|
Error = context.Error,
|
||||||
@@ -873,34 +860,34 @@
|
|||||||
String = context.String,
|
String = context.String,
|
||||||
TypeError = context.TypeError;
|
TypeError = context.TypeError;
|
||||||
|
|
||||||
/** Used for native method references */
|
/** Used for native method references. */
|
||||||
var arrayProto = Array.prototype,
|
var arrayProto = Array.prototype,
|
||||||
errorProto = Error.prototype,
|
errorProto = Error.prototype,
|
||||||
objectProto = Object.prototype,
|
objectProto = Object.prototype,
|
||||||
stringProto = String.prototype;
|
stringProto = String.prototype;
|
||||||
|
|
||||||
/** Used to detect DOM support */
|
/** Used to detect DOM support. */
|
||||||
var document = (document = context.window) && document.document;
|
var document = (document = context.window) && document.document;
|
||||||
|
|
||||||
/** Used to resolve the decompiled source of functions */
|
/** Used to resolve the decompiled source of functions. */
|
||||||
var fnToString = Function.prototype.toString;
|
var fnToString = Function.prototype.toString;
|
||||||
|
|
||||||
/** Used to check objects for own properties */
|
/** Used to check objects for own properties. */
|
||||||
var hasOwnProperty = objectProto.hasOwnProperty;
|
var hasOwnProperty = objectProto.hasOwnProperty;
|
||||||
|
|
||||||
/** Used to restore the original `_` reference in `_.noConflict` */
|
/** Used to restore the original `_` reference in `_.noConflict`. */
|
||||||
var oldDash = context._;
|
var oldDash = context._;
|
||||||
|
|
||||||
/** Used to resolve the internal `[[Class]]` of values */
|
/** Used to resolve the internal `[[Class]]` of values. */
|
||||||
var toString = objectProto.toString;
|
var toString = objectProto.toString;
|
||||||
|
|
||||||
/** Used to detect if a method is native */
|
/** Used to detect if a method is native. */
|
||||||
var reNative = RegExp('^' +
|
var reNative = RegExp('^' +
|
||||||
escapeRegExp(toString)
|
escapeRegExp(toString)
|
||||||
.replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
|
.replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
|
||||||
);
|
);
|
||||||
|
|
||||||
/** Native method references */
|
/** Native method references. */
|
||||||
var ArrayBuffer = isNative(ArrayBuffer = context.ArrayBuffer) && ArrayBuffer,
|
var ArrayBuffer = isNative(ArrayBuffer = context.ArrayBuffer) && ArrayBuffer,
|
||||||
bufferSlice = isNative(bufferSlice = ArrayBuffer && new ArrayBuffer(0).slice) && bufferSlice,
|
bufferSlice = isNative(bufferSlice = ArrayBuffer && new ArrayBuffer(0).slice) && bufferSlice,
|
||||||
ceil = Math.ceil,
|
ceil = Math.ceil,
|
||||||
@@ -916,7 +903,7 @@
|
|||||||
unshift = arrayProto.unshift,
|
unshift = arrayProto.unshift,
|
||||||
WeakMap = isNative(WeakMap = context.WeakMap) && WeakMap;
|
WeakMap = isNative(WeakMap = context.WeakMap) && WeakMap;
|
||||||
|
|
||||||
/** Used to clone array buffers */
|
/** Used to clone array buffers. */
|
||||||
var Float64Array = (function() {
|
var Float64Array = (function() {
|
||||||
// Safari 5 errors when using an array buffer to initialize a typed array
|
// Safari 5 errors when using an array buffer to initialize a typed array
|
||||||
// where the array buffer's `byteLength` is not a multiple of the typed
|
// where the array buffer's `byteLength` is not a multiple of the typed
|
||||||
@@ -928,7 +915,7 @@
|
|||||||
return result;
|
return result;
|
||||||
}());
|
}());
|
||||||
|
|
||||||
/* Native method references for those with the same name as other `lodash` methods */
|
/* Native method references for those with the same name as other `lodash` methods. */
|
||||||
var nativeCreate = isNative(nativeCreate = Object.create) && nativeCreate,
|
var nativeCreate = isNative(nativeCreate = Object.create) && nativeCreate,
|
||||||
nativeIsArray = isNative(nativeIsArray = Array.isArray) && nativeIsArray,
|
nativeIsArray = isNative(nativeIsArray = Array.isArray) && nativeIsArray,
|
||||||
nativeIsFinite = context.isFinite,
|
nativeIsFinite = context.isFinite,
|
||||||
@@ -940,15 +927,15 @@
|
|||||||
nativeParseInt = context.parseInt,
|
nativeParseInt = context.parseInt,
|
||||||
nativeRandom = Math.random;
|
nativeRandom = Math.random;
|
||||||
|
|
||||||
/** Used as references for `-Infinity` and `Infinity` */
|
/** Used as references for `-Infinity` and `Infinity`. */
|
||||||
var NEGATIVE_INFINITY = Number.NEGATIVE_INFINITY,
|
var NEGATIVE_INFINITY = Number.NEGATIVE_INFINITY,
|
||||||
POSITIVE_INFINITY = Number.POSITIVE_INFINITY;
|
POSITIVE_INFINITY = Number.POSITIVE_INFINITY;
|
||||||
|
|
||||||
/** Used as references for the max length and index of an array */
|
/** Used as references for the max length and index of an array. */
|
||||||
var MAX_ARRAY_LENGTH = Math.pow(2, 32) - 1,
|
var MAX_ARRAY_LENGTH = Math.pow(2, 32) - 1,
|
||||||
MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1;
|
MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1;
|
||||||
|
|
||||||
/** Used as the size, in bytes, of each Float64Array element */
|
/** Used as the size, in bytes, of each Float64Array element. */
|
||||||
var FLOAT64_BYTES_PER_ELEMENT = Float64Array ? Float64Array.BYTES_PER_ELEMENT : 0;
|
var FLOAT64_BYTES_PER_ELEMENT = Float64Array ? Float64Array.BYTES_PER_ELEMENT : 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -958,10 +945,10 @@
|
|||||||
*/
|
*/
|
||||||
var MAX_SAFE_INTEGER = Math.pow(2, 53) - 1;
|
var MAX_SAFE_INTEGER = Math.pow(2, 53) - 1;
|
||||||
|
|
||||||
/** Used to store function metadata */
|
/** Used to store function metadata. */
|
||||||
var metaMap = WeakMap && new WeakMap;
|
var metaMap = WeakMap && new WeakMap;
|
||||||
|
|
||||||
/** Used to lookup a built-in constructor by `[[Class]]` */
|
/** Used to lookup a built-in constructor by `[[Class]]`. */
|
||||||
var ctorByClass = {};
|
var ctorByClass = {};
|
||||||
ctorByClass[float32Class] = context.Float32Array;
|
ctorByClass[float32Class] = context.Float32Array;
|
||||||
ctorByClass[float64Class] = context.Float64Array;
|
ctorByClass[float64Class] = context.Float64Array;
|
||||||
@@ -973,7 +960,7 @@
|
|||||||
ctorByClass[uint16Class] = context.Uint16Array;
|
ctorByClass[uint16Class] = context.Uint16Array;
|
||||||
ctorByClass[uint32Class] = context.Uint32Array;
|
ctorByClass[uint32Class] = context.Uint32Array;
|
||||||
|
|
||||||
/** Used to avoid iterating over non-enumerable properties in IE < 9 */
|
/** Used to avoid iterating over non-enumerable properties in IE < 9. */
|
||||||
var nonEnumProps = {};
|
var nonEnumProps = {};
|
||||||
nonEnumProps[arrayClass] = nonEnumProps[dateClass] = nonEnumProps[numberClass] = { 'constructor': true, 'toLocaleString': true, 'toString': true, 'valueOf': true };
|
nonEnumProps[arrayClass] = nonEnumProps[dateClass] = nonEnumProps[numberClass] = { 'constructor': true, 'toLocaleString': true, 'toString': true, 'valueOf': true };
|
||||||
nonEnumProps[boolClass] = nonEnumProps[stringClass] = { 'constructor': true, 'toString': true, 'valueOf': true };
|
nonEnumProps[boolClass] = nonEnumProps[stringClass] = { 'constructor': true, 'toString': true, 'valueOf': true };
|
||||||
@@ -1677,8 +1664,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The base implementation of `_.callback` without support for creating
|
* The base implementation of `_.callback`.
|
||||||
* "_.pluck" and "_.where" style callbacks.
|
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {*} [func=_.identity] The value to convert to a callback.
|
* @param {*} [func=_.identity] The value to convert to a callback.
|
||||||
@@ -2482,7 +2468,7 @@
|
|||||||
/**
|
/**
|
||||||
* The base implementation of `_.reduce` and `_.reduceRight` without support
|
* The base implementation of `_.reduce` and `_.reduceRight` without support
|
||||||
* for callback shorthands or `this` binding, which iterates over `collection`
|
* for callback shorthands or `this` binding, which iterates over `collection`
|
||||||
* usingthe provided `eachFunc`.
|
* using the provided `eachFunc`.
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {Array|Object|string} collection The collection to iterate over.
|
* @param {Array|Object|string} collection The collection to iterate over.
|
||||||
@@ -2920,6 +2906,8 @@
|
|||||||
key = func;
|
key = func;
|
||||||
|
|
||||||
function wrapper() {
|
function wrapper() {
|
||||||
|
// Avoid `arguments` object use disqualifying optimizations by
|
||||||
|
// converting it to an array before providing it to other functions.
|
||||||
var length = arguments.length,
|
var length = arguments.length,
|
||||||
index = length,
|
index = length,
|
||||||
args = Array(length);
|
args = Array(length);
|
||||||
@@ -2994,7 +2982,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a function that wraps `func` and invokes it with the optional `this`
|
* Creates a function that wraps `func` and invokes it with the optional `this`
|
||||||
* binding of `thisArg` and the `partialArgs` prepended to those provided to
|
* binding of `thisArg` and the `partials` prepended to those provided to
|
||||||
* the wrapper.
|
* the wrapper.
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
@@ -3010,7 +2998,7 @@
|
|||||||
|
|
||||||
function wrapper() {
|
function wrapper() {
|
||||||
// Avoid `arguments` object use disqualifying optimizations by
|
// Avoid `arguments` object use disqualifying optimizations by
|
||||||
// converting it to an array before providing it to `composeArgs`.
|
// converting it to an array before providing it `func`.
|
||||||
var argsIndex = -1,
|
var argsIndex = -1,
|
||||||
argsLength = arguments.length,
|
argsLength = arguments.length,
|
||||||
leftIndex = -1,
|
leftIndex = -1,
|
||||||
@@ -3046,7 +3034,7 @@
|
|||||||
* 128 - `_.rearg`
|
* 128 - `_.rearg`
|
||||||
* @param {*} [thisArg] The `this` binding of `func`.
|
* @param {*} [thisArg] The `this` binding of `func`.
|
||||||
* @param {Array} [partials] The arguments to be partially applied.
|
* @param {Array} [partials] The arguments to be partially applied.
|
||||||
* @param {Array} [holders] The `partialArgs` placeholder indexes.
|
* @param {Array} [holders] The `partials` placeholder indexes.
|
||||||
* @param {Array} [argPos] The argument positions of the new function.
|
* @param {Array} [argPos] The argument positions of the new function.
|
||||||
* @param {number} [arity] The arity of `func`.
|
* @param {number} [arity] The arity of `func`.
|
||||||
* @returns {Function} Returns the new wrapped function.
|
* @returns {Function} Returns the new wrapped function.
|
||||||
@@ -3342,7 +3330,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if `value` is valid array-like length.
|
* Checks if `value` is a valid array-like length.
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {*} value The value to check.
|
* @param {*} value The value to check.
|
||||||
@@ -8564,6 +8552,17 @@
|
|||||||
* **Note:** No other characters are escaped. To escape additional characters
|
* **Note:** No other characters are escaped. To escape additional characters
|
||||||
* use a third-party library like [_he_](http://mths.be/he).
|
* use a third-party library like [_he_](http://mths.be/he).
|
||||||
*
|
*
|
||||||
|
* Though the ">" character is escaped for symmetry, characters like
|
||||||
|
* ">" and "/" don't require escaping in HTML and have no special meaning
|
||||||
|
* unless they're part of a tag or unquoted attribute value.
|
||||||
|
* See [Mathias Bynens's article](http://mathiasbynens.be/notes/ambiguous-ampersands)
|
||||||
|
* (under "semi-related fun fact") for more details.
|
||||||
|
*
|
||||||
|
* Backticks are escaped because in Internet Explorer < 9, they can break out
|
||||||
|
* of attribute values or HTML comments. See [#102](http://html5sec.org/#102),
|
||||||
|
* [#108](http://html5sec.org/#108), and [#133](http://html5sec.org/#133) of
|
||||||
|
* the [HTML5 Security Cheatsheet](http://html5sec.org/) for more details.
|
||||||
|
*
|
||||||
* When working with HTML you should always quote attribute values to reduce
|
* When working with HTML you should always quote attribute values to reduce
|
||||||
* XSS vectors. See [Ryan Grove's article](http://wonko.com/post/html-escaping)
|
* XSS vectors. See [Ryan Grove's article](http://wonko.com/post/html-escaping)
|
||||||
* for more details.
|
* for more details.
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
;(function(window) {
|
;(function(window) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
/** The base path of the builds */
|
/** The base path of the Lo-Dash builds. */
|
||||||
var basePath = '../';
|
var basePath = '../';
|
||||||
|
|
||||||
/** The Lo-Dash build to load */
|
/** The Lo-Dash build to load. */
|
||||||
var build = (build = /build=([^&]+)/.exec(location.search)) && decodeURIComponent(build[1]);
|
var build = (build = /build=([^&]+)/.exec(location.search)) && decodeURIComponent(build[1]);
|
||||||
|
|
||||||
/** The other library to load */
|
/** The other library to load. */
|
||||||
var other = (other = /other=([^&]+)/.exec(location.search)) && decodeURIComponent(other[1]);
|
var other = (other = /other=([^&]+)/.exec(location.search)) && decodeURIComponent(other[1]);
|
||||||
|
|
||||||
/** The `ui` object */
|
/** The `ui` object. */
|
||||||
var ui = {};
|
var ui = {};
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
// initialize controls
|
// Initialize controls.
|
||||||
addListener(window, 'load', function() {
|
addListener(window, 'load', function() {
|
||||||
function eventHandler(event) {
|
function eventHandler(event) {
|
||||||
var buildIndex = buildList.selectedIndex,
|
var buildIndex = buildList.selectedIndex,
|
||||||
@@ -112,7 +112,7 @@
|
|||||||
addListener(otherList, 'change', eventHandler);
|
addListener(otherList, 'change', eventHandler);
|
||||||
});
|
});
|
||||||
|
|
||||||
// expose Lo-Dash build file path
|
// The Lo-Dash build file path.
|
||||||
ui.buildPath = (function() {
|
ui.buildPath = (function() {
|
||||||
var result;
|
var result;
|
||||||
switch (build) {
|
switch (build) {
|
||||||
@@ -126,7 +126,7 @@
|
|||||||
return basePath + result;
|
return basePath + result;
|
||||||
}());
|
}());
|
||||||
|
|
||||||
// expose other library file path
|
// The other library file path.
|
||||||
ui.otherPath = (function() {
|
ui.otherPath = (function() {
|
||||||
var result;
|
var result;
|
||||||
switch (other) {
|
switch (other) {
|
||||||
@@ -142,13 +142,8 @@
|
|||||||
return basePath + result;
|
return basePath + result;
|
||||||
}());
|
}());
|
||||||
|
|
||||||
// expose `ui.urlParams` properties
|
ui.urlParams = { 'build': build, 'other': other };
|
||||||
ui.urlParams = {
|
|
||||||
'build': build,
|
|
||||||
'other': other
|
|
||||||
};
|
|
||||||
|
|
||||||
// expose `ui`
|
|
||||||
window.ui = ui;
|
window.ui = ui;
|
||||||
|
|
||||||
}(this));
|
}(this));
|
||||||
|
|||||||
58
perf/perf.js
58
perf/perf.js
@@ -1,15 +1,15 @@
|
|||||||
;(function() {
|
;(function() {
|
||||||
|
|
||||||
/** Used to access the Firebug Lite panel (set by `run`) */
|
/** Used to access the Firebug Lite panel (set by `run`). */
|
||||||
var fbPanel;
|
var fbPanel;
|
||||||
|
|
||||||
/** Used as a safe reference for `undefined` in pre ES5 environments */
|
/** Used as a safe reference for `undefined` in pre ES5 environments. */
|
||||||
var undefined;
|
var undefined;
|
||||||
|
|
||||||
/** Used as a reference to the global object */
|
/** Used as a reference to the global object. */
|
||||||
var root = typeof global == 'object' && global || this;
|
var root = typeof global == 'object' && global || this;
|
||||||
|
|
||||||
/** Method and object shortcuts */
|
/** Method and object shortcuts. */
|
||||||
var phantom = root.phantom,
|
var phantom = root.phantom,
|
||||||
amd = root.define && define.amd,
|
amd = root.define && define.amd,
|
||||||
argv = root.process && process.argv,
|
argv = root.process && process.argv,
|
||||||
@@ -18,10 +18,10 @@
|
|||||||
params = root.arguments,
|
params = root.arguments,
|
||||||
system = root.system;
|
system = root.system;
|
||||||
|
|
||||||
/** Add `console.log()` support for Narwhal, Rhino, and RingoJS */
|
/** Add `console.log()` support for Narwhal, Rhino, and RingoJS. */
|
||||||
var console = root.console || (root.console = { 'log': root.print });
|
var console = root.console || (root.console = { 'log': root.print });
|
||||||
|
|
||||||
/** The file path of the Lo-Dash file to test */
|
/** The file path of the Lo-Dash file to test. */
|
||||||
var filePath = (function() {
|
var filePath = (function() {
|
||||||
var min = 0,
|
var min = 0,
|
||||||
result = [];
|
result = [];
|
||||||
@@ -52,51 +52,51 @@
|
|||||||
return result;
|
return result;
|
||||||
}());
|
}());
|
||||||
|
|
||||||
/** Used to match path separators */
|
/** Used to match path separators. */
|
||||||
var rePathSeparator = /[\/\\]/;
|
var rePathSeparator = /[\/\\]/;
|
||||||
|
|
||||||
/** Used to detect primitive types */
|
/** Used to detect primitive types. */
|
||||||
var rePrimitive = /^(?:boolean|number|string|undefined)$/;
|
var rePrimitive = /^(?:boolean|number|string|undefined)$/;
|
||||||
|
|
||||||
/** Used to match RegExp special characters */
|
/** Used to match RegExp special characters. */
|
||||||
var reSpecialChars = /[.*+?^=!:${}()|[\]\/\\]/g;
|
var reSpecialChars = /[.*+?^=!:${}()|[\]\/\\]/g;
|
||||||
|
|
||||||
/** The `ui` object */
|
/** The `ui` object. */
|
||||||
var ui = root.ui || (root.ui = {
|
var ui = root.ui || (root.ui = {
|
||||||
'buildPath': basename(filePath, '.js'),
|
'buildPath': basename(filePath, '.js'),
|
||||||
'otherPath': 'underscore'
|
'otherPath': 'underscore'
|
||||||
});
|
});
|
||||||
|
|
||||||
/** The Lo-Dash build basename */
|
/** The Lo-Dash build basename. */
|
||||||
var buildName = root.buildName = basename(ui.buildPath, '.js');
|
var buildName = root.buildName = basename(ui.buildPath, '.js');
|
||||||
|
|
||||||
/** The other library basename */
|
/** The other library basename. */
|
||||||
var otherName = root.otherName = (function() {
|
var otherName = root.otherName = (function() {
|
||||||
var result = basename(ui.otherPath, '.js');
|
var result = basename(ui.otherPath, '.js');
|
||||||
return result + (result == buildName ? ' (2)' : '');
|
return result + (result == buildName ? ' (2)' : '');
|
||||||
}());
|
}());
|
||||||
|
|
||||||
/** Used to score performance */
|
/** Used to score performance. */
|
||||||
var score = { 'a': [], 'b': [] };
|
var score = { 'a': [], 'b': [] };
|
||||||
|
|
||||||
/** Used to queue benchmark suites */
|
/** Used to queue benchmark suites. */
|
||||||
var suites = [];
|
var suites = [];
|
||||||
|
|
||||||
/** Used to resolve a value's internal [[Class]] */
|
/** Used to resolve a value's internal [[Class]]. */
|
||||||
var toString = Object.prototype.toString;
|
var toString = Object.prototype.toString;
|
||||||
|
|
||||||
/** Detect if in a browser environment */
|
/** Detect if in a browser environment. */
|
||||||
var isBrowser = isHostType(root, 'document') && isHostType(root, 'navigator');
|
var isBrowser = isHostType(root, 'document') && isHostType(root, 'navigator');
|
||||||
|
|
||||||
/** Detect if in a Java environment */
|
/** Detect if in a Java environment. */
|
||||||
var isJava = !isBrowser && /Java/.test(toString.call(root.java));
|
var isJava = !isBrowser && /Java/.test(toString.call(root.java));
|
||||||
|
|
||||||
/** Use a single "load" function */
|
/** Use a single "load" function. */
|
||||||
var load = (typeof require == 'function' && !amd)
|
var load = (typeof require == 'function' && !amd)
|
||||||
? require
|
? require
|
||||||
: (isJava && root.load) || noop;
|
: (isJava && root.load) || noop;
|
||||||
|
|
||||||
/** Load Lo-Dash */
|
/** Load Lo-Dash. */
|
||||||
var lodash = root.lodash || (root.lodash = (
|
var lodash = root.lodash || (root.lodash = (
|
||||||
lodash = load(filePath) || root._,
|
lodash = load(filePath) || root._,
|
||||||
lodash = lodash._ || lodash,
|
lodash = lodash._ || lodash,
|
||||||
@@ -104,14 +104,14 @@
|
|||||||
lodash.noConflict()
|
lodash.noConflict()
|
||||||
));
|
));
|
||||||
|
|
||||||
/** Load Benchmark.js */
|
/** Load Benchmark.js. */
|
||||||
var Benchmark = root.Benchmark || (root.Benchmark = (
|
var Benchmark = root.Benchmark || (root.Benchmark = (
|
||||||
Benchmark = load('../vendor/benchmark.js/benchmark.js') || root.Benchmark,
|
Benchmark = load('../vendor/benchmark.js/benchmark.js') || root.Benchmark,
|
||||||
Benchmark = Benchmark.Benchmark || Benchmark,
|
Benchmark = Benchmark.Benchmark || Benchmark,
|
||||||
Benchmark.runInContext(lodash.extend({}, root, { '_': lodash }))
|
Benchmark.runInContext(lodash.extend({}, root, { '_': lodash }))
|
||||||
));
|
));
|
||||||
|
|
||||||
/** Load Underscore */
|
/** Load Underscore. */
|
||||||
var _ = root._ || (root._ = (
|
var _ = root._ || (root._ = (
|
||||||
_ = load('../vendor/underscore/underscore.js') || root._,
|
_ = load('../vendor/underscore/underscore.js') || root._,
|
||||||
_._ || _
|
_._ || _
|
||||||
@@ -189,7 +189,7 @@
|
|||||||
function log(text) {
|
function log(text) {
|
||||||
console.log(text + '');
|
console.log(text + '');
|
||||||
if (fbPanel) {
|
if (fbPanel) {
|
||||||
// scroll the Firebug Lite panel down
|
// Scroll the Firebug Lite panel down.
|
||||||
fbPanel.scrollTop = fbPanel.scrollHeight;
|
fbPanel.scrollTop = fbPanel.scrollHeight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -249,15 +249,15 @@
|
|||||||
'% faster.'
|
'% faster.'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// add score adjusted for margin of error
|
// Add score adjusted for margin of error.
|
||||||
score.a.push(aHz);
|
score.a.push(aHz);
|
||||||
score.b.push(bHz);
|
score.b.push(bHz);
|
||||||
}
|
}
|
||||||
// remove current suite from queue
|
// Remove current suite from queue.
|
||||||
suites.shift();
|
suites.shift();
|
||||||
|
|
||||||
if (suites.length) {
|
if (suites.length) {
|
||||||
// run next suite
|
// Run next suite.
|
||||||
suites[0].run({ 'async': !isJava });
|
suites[0].run({ 'async': !isJava });
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -269,7 +269,7 @@
|
|||||||
percentFaster = formatNumber(Math.round((xFaster - 1) * 100)),
|
percentFaster = formatNumber(Math.round((xFaster - 1) * 100)),
|
||||||
message = 'is ' + percentFaster + '% ' + (xFaster == 1 ? '' : '(' + formatNumber(xFaster.toFixed(2)) + 'x) ') + 'faster than';
|
message = 'is ' + percentFaster + '% ' + (xFaster == 1 ? '' : '(' + formatNumber(xFaster.toFixed(2)) + 'x) ') + 'faster than';
|
||||||
|
|
||||||
// report results
|
// Report results.
|
||||||
if (aMeanHz >= bMeanHz) {
|
if (aMeanHz >= bMeanHz) {
|
||||||
log('\n' + buildName + ' ' + message + ' ' + otherName + '.');
|
log('\n' + buildName + ' ' + message + ' ' + otherName + '.');
|
||||||
} else {
|
} else {
|
||||||
@@ -334,7 +334,7 @@
|
|||||||
return /^_/.test(funcName);\
|
return /^_/.test(funcName);\
|
||||||
});\
|
});\
|
||||||
\
|
\
|
||||||
// potentially expensive\n\
|
// Potentially expensive.\n\
|
||||||
for (index = 0; index < this.count; index++) {\
|
for (index = 0; index < this.count; index++) {\
|
||||||
bindAllObjects[index] = belt.reduce(funcNames, function(object, funcName) {\
|
bindAllObjects[index] = belt.reduce(funcNames, function(object, funcName) {\
|
||||||
object[funcName] = belt[funcName];\
|
object[funcName] = belt[funcName];\
|
||||||
@@ -974,7 +974,7 @@
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
// avoid Underscore induced `OutOfMemoryError` in Rhino, Narwhal, and Ringo
|
// Avoid Underscore induced `OutOfMemoryError` in Rhino, Narwhal, and Ringo.
|
||||||
if (!isJava) {
|
if (!isJava) {
|
||||||
suites.push(
|
suites.push(
|
||||||
Benchmark.Suite('`_.find` with `properties`')
|
Benchmark.Suite('`_.find` with `properties`')
|
||||||
@@ -2080,7 +2080,7 @@
|
|||||||
if (Benchmark.platform + '') {
|
if (Benchmark.platform + '') {
|
||||||
log(Benchmark.platform);
|
log(Benchmark.platform);
|
||||||
}
|
}
|
||||||
// in the browser, expose `run` to be called later
|
// Expose `run` to be called later when executing in a browser.
|
||||||
if (document) {
|
if (document) {
|
||||||
root.run = run;
|
root.run = run;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1,21 +1,21 @@
|
|||||||
;(function() {
|
;(function() {
|
||||||
|
|
||||||
/** Used to determine if values are of the language type Object */
|
/** Used to determine if values are of the language type Object. */
|
||||||
var objectTypes = {
|
var objectTypes = {
|
||||||
'function': true,
|
'function': true,
|
||||||
'object': true
|
'object': true
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Used as the `Set#toString` return value */
|
/** Used as the `Set#toString` return value. */
|
||||||
var nativeString = String(Object.prototype.toString).replace(/toString/g, 'Set');
|
var nativeString = String(Object.prototype.toString).replace(/toString/g, 'Set');
|
||||||
|
|
||||||
/** Used as a reference to the global object */
|
/** Used as a reference to the global object. */
|
||||||
var root = (objectTypes[typeof window] && window) || this;
|
var root = (objectTypes[typeof window] && window) || this;
|
||||||
|
|
||||||
/** Detect free variable `exports` */
|
/** Detect free variable `exports`. */
|
||||||
var freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports;
|
var freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports;
|
||||||
|
|
||||||
/** Detect free variable `global` from Node.js or Browserified code and use it as `root` */
|
/** Detect free variable `global` from Node.js or Browserified code and use it as `root`. */
|
||||||
var freeGlobal = objectTypes[typeof global] && global;
|
var freeGlobal = objectTypes[typeof global] && global;
|
||||||
if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal)) {
|
if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal)) {
|
||||||
root = freeGlobal;
|
root = freeGlobal;
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
;(function(window) {
|
;(function(window) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
/** The base path of the builds */
|
/** The base path of the Lo-Dash builds. */
|
||||||
var basePath = '../';
|
var basePath = '../';
|
||||||
|
|
||||||
/** The Lo-Dash build to load */
|
/** The Lo-Dash build to load. */
|
||||||
var build = (build = /build=([^&]+)/.exec(location.search)) && decodeURIComponent(build[1]);
|
var build = (build = /build=([^&]+)/.exec(location.search)) && decodeURIComponent(build[1]);
|
||||||
|
|
||||||
/** The module loader to use */
|
/** The module loader to use. */
|
||||||
var loader = (loader = /loader=([^&]+)/.exec(location.search)) && decodeURIComponent(loader[1]);
|
var loader = (loader = /loader=([^&]+)/.exec(location.search)) && decodeURIComponent(loader[1]);
|
||||||
|
|
||||||
/** The `ui` object */
|
/** The `ui` object. */
|
||||||
var ui = {};
|
var ui = {};
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
// initialize controls
|
// Initialize controls.
|
||||||
addListener(window, 'load', function() {
|
addListener(window, 'load', function() {
|
||||||
function eventHandler(event) {
|
function eventHandler(event) {
|
||||||
var buildIndex = buildList.selectedIndex,
|
var buildIndex = buildList.selectedIndex,
|
||||||
@@ -124,19 +124,19 @@
|
|||||||
init();
|
init();
|
||||||
});
|
});
|
||||||
|
|
||||||
// used to indicate that Lo-Dash is in strict mode
|
// Used to indicate that Lo-Dash is in strict mode.
|
||||||
ui.isStrict = /\b(?:lodash-es6|transpiled)\b/.test([location.pathname, location.search]);
|
ui.isStrict = /\b(?:lodash-es6|transpiled)\b/.test([location.pathname, location.search]);
|
||||||
|
|
||||||
// used to indicate testing a foreign file
|
// Used to indicate testing a foreign file.
|
||||||
ui.isForeign = RegExp('^(\\w+:)?//').test(build);
|
ui.isForeign = RegExp('^(\\w+:)?//').test(build);
|
||||||
|
|
||||||
// used to indicate testing a modularized build
|
// Used to indicate testing a modularized build.
|
||||||
ui.isModularize = /\b(?:commonjs|(index|main)\.js|lodash-(?:amd|es6|node)|modularize|npm|transpiled)\b/.test([location.pathname, location.search]);
|
ui.isModularize = /\b(?:commonjs|(index|main)\.js|lodash-(?:amd|es6|node)|modularize|npm|transpiled)\b/.test([location.pathname, location.search]);
|
||||||
|
|
||||||
// used to indicate testing in Sauce Labs' automated test cloud
|
// Used to indicate testing in Sauce Labs' automated test cloud.
|
||||||
ui.isSauceLabs = location.port == '9001';
|
ui.isSauceLabs = location.port == '9001';
|
||||||
|
|
||||||
// expose Lo-Dash build file path
|
// The Lo-Dash build file path.
|
||||||
ui.buildPath = (function() {
|
ui.buildPath = (function() {
|
||||||
var result;
|
var result;
|
||||||
switch (build) {
|
switch (build) {
|
||||||
@@ -152,7 +152,7 @@
|
|||||||
return basePath + result;
|
return basePath + result;
|
||||||
}());
|
}());
|
||||||
|
|
||||||
// expose module loader file path
|
// The module loader file path.
|
||||||
ui.loaderPath = (function() {
|
ui.loaderPath = (function() {
|
||||||
var result;
|
var result;
|
||||||
switch (loader) {
|
switch (loader) {
|
||||||
@@ -165,18 +165,9 @@
|
|||||||
return basePath + result;
|
return basePath + result;
|
||||||
}());
|
}());
|
||||||
|
|
||||||
// expose `ui.urlParams` properties
|
ui.urlParams = { 'build': build, 'loader': loader };
|
||||||
ui.urlParams = {
|
ui.timing = { 'loadEventEnd': 0 };
|
||||||
'build': build,
|
|
||||||
'loader': loader
|
|
||||||
};
|
|
||||||
|
|
||||||
// expose page load timestamps
|
|
||||||
ui.timing = {
|
|
||||||
'loadEventEnd': 0
|
|
||||||
};
|
|
||||||
|
|
||||||
// expose `ui`
|
|
||||||
window.ui = ui;
|
window.ui = ui;
|
||||||
|
|
||||||
}(this));
|
}(this));
|
||||||
|
|||||||
@@ -1,21 +1,21 @@
|
|||||||
;(function() {
|
;(function() {
|
||||||
|
|
||||||
/** Used to determine if values are of the language type Object */
|
/** Used to determine if values are of the language type Object. */
|
||||||
var objectTypes = {
|
var objectTypes = {
|
||||||
'function': true,
|
'function': true,
|
||||||
'object': true
|
'object': true
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Used as the `WeakMap#toString` return value */
|
/** Used as the `WeakMap#toString` return value. */
|
||||||
var nativeString = String(Object.prototype.toString).replace(/toString/g, 'WeakMap');
|
var nativeString = String(Object.prototype.toString).replace(/toString/g, 'WeakMap');
|
||||||
|
|
||||||
/** Used as a reference to the global object */
|
/** Used as a reference to the global object. */
|
||||||
var root = (objectTypes[typeof window] && window) || this;
|
var root = (objectTypes[typeof window] && window) || this;
|
||||||
|
|
||||||
/** Detect free variable `exports` */
|
/** Detect free variable `exports`. */
|
||||||
var freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports;
|
var freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports;
|
||||||
|
|
||||||
/** Detect free variable `global` from Node.js or Browserified code and use it as `root` */
|
/** Detect free variable `global` from Node.js or Browserified code and use it as `root`. */
|
||||||
var freeGlobal = objectTypes[typeof global] && global;
|
var freeGlobal = objectTypes[typeof global] && global;
|
||||||
if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal)) {
|
if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal)) {
|
||||||
root = freeGlobal;
|
root = freeGlobal;
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
* Creates a `WeakMap` object.
|
* Creates a `WeakMap` object.
|
||||||
*/
|
*/
|
||||||
function WeakMap() {
|
function WeakMap() {
|
||||||
// no-op
|
// No operation performed.
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
/** Environment shortcut */
|
/** Environment shortcut. */
|
||||||
var env = process.env;
|
var env = process.env;
|
||||||
|
|
||||||
if (env.TRAVIS_SECURE_ENV_VARS == 'false') {
|
if (env.TRAVIS_SECURE_ENV_VARS == 'false') {
|
||||||
@@ -9,35 +9,35 @@ if (env.TRAVIS_SECURE_ENV_VARS == 'false') {
|
|||||||
process.exit(0);
|
process.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Load Node.js modules */
|
/** Load Node.js modules. */
|
||||||
var EventEmitter = require('events').EventEmitter,
|
var EventEmitter = require('events').EventEmitter,
|
||||||
http = require('http'),
|
http = require('http'),
|
||||||
path = require('path'),
|
path = require('path'),
|
||||||
url = require('url'),
|
url = require('url'),
|
||||||
util = require('util');
|
util = require('util');
|
||||||
|
|
||||||
/** Load other modules */
|
/** Load other modules. */
|
||||||
var _ = require('../lodash.js'),
|
var _ = require('../lodash.js'),
|
||||||
chalk = require('chalk'),
|
chalk = require('chalk'),
|
||||||
ecstatic = require('ecstatic'),
|
ecstatic = require('ecstatic'),
|
||||||
request = require('request'),
|
request = require('request'),
|
||||||
SauceTunnel = require('sauce-tunnel');
|
SauceTunnel = require('sauce-tunnel');
|
||||||
|
|
||||||
/** Used for Sauce Labs credentials */
|
/** Used for Sauce Labs credentials. */
|
||||||
var accessKey = env.SAUCE_ACCESS_KEY,
|
var accessKey = env.SAUCE_ACCESS_KEY,
|
||||||
username = env.SAUCE_USERNAME;
|
username = env.SAUCE_USERNAME;
|
||||||
|
|
||||||
/** Used as the default maximum number of times to retry a job and tunnel */
|
/** Used as the default maximum number of times to retry a job and tunnel. */
|
||||||
var maxJobRetries = 3,
|
var maxJobRetries = 3,
|
||||||
maxTunnelRetries = 3;
|
maxTunnelRetries = 3;
|
||||||
|
|
||||||
/** Used as the static file server middleware */
|
/** Used as the static file server middleware. */
|
||||||
var mount = ecstatic({
|
var mount = ecstatic({
|
||||||
'cache': 'no-cache',
|
'cache': 'no-cache',
|
||||||
'root': process.cwd()
|
'root': process.cwd()
|
||||||
});
|
});
|
||||||
|
|
||||||
/** Used as the list of ports supported by Sauce Connect */
|
/** Used as the list of ports supported by Sauce Connect. */
|
||||||
var ports = [
|
var ports = [
|
||||||
80, 443, 888, 2000, 2001, 2020, 2109, 2222, 2310, 3000, 3001, 3030, 3210,
|
80, 443, 888, 2000, 2001, 2020, 2109, 2222, 2310, 3000, 3001, 3030, 3210,
|
||||||
3333, 4000, 4001, 4040, 4321, 4502, 4503, 4567, 5000, 5001, 5050, 5555, 5432,
|
3333, 4000, 4001, 4040, 4321, 4502, 4503, 4567, 5000, 5001, 5050, 5555, 5432,
|
||||||
@@ -46,19 +46,19 @@ var ports = [
|
|||||||
55001
|
55001
|
||||||
];
|
];
|
||||||
|
|
||||||
/** Used by `logInline` to clear previously logged messages */
|
/** Used by `logInline` to clear previously logged messages. */
|
||||||
var prevLine = '';
|
var prevLine = '';
|
||||||
|
|
||||||
/** Method shortcut */
|
/** Method shortcut. */
|
||||||
var push = Array.prototype.push;
|
var push = Array.prototype.push;
|
||||||
|
|
||||||
/** Used to detect error messages */
|
/** Used to detect error messages. */
|
||||||
var reError = /(?:\be|E)rror\b/;
|
var reError = /(?:\be|E)rror\b/;
|
||||||
|
|
||||||
/** Used to detect valid job ids */
|
/** Used to detect valid job ids. */
|
||||||
var reJobId = /^[a-z0-9]{32}$/;
|
var reJobId = /^[a-z0-9]{32}$/;
|
||||||
|
|
||||||
/** Used to display the wait throbber */
|
/** Used to display the wait throbber. */
|
||||||
var throbberDelay = 500,
|
var throbberDelay = 500,
|
||||||
waitCount = -1;
|
waitCount = -1;
|
||||||
|
|
||||||
@@ -92,7 +92,7 @@ var advisor = getOption('advisor', false),
|
|||||||
tunnelTimeout = getOption('tunnelTimeout', 120),
|
tunnelTimeout = getOption('tunnelTimeout', 120),
|
||||||
videoUploadOnPass = getOption('videoUploadOnPass', false);
|
videoUploadOnPass = getOption('videoUploadOnPass', false);
|
||||||
|
|
||||||
/** Used to convert Sauce Labs browser identifiers to their formal names */
|
/** Used to convert Sauce Labs browser identifiers to their formal names. */
|
||||||
var browserNameMap = {
|
var browserNameMap = {
|
||||||
'googlechrome': 'Chrome',
|
'googlechrome': 'Chrome',
|
||||||
'iehta': 'Internet Explorer',
|
'iehta': 'Internet Explorer',
|
||||||
@@ -100,7 +100,7 @@ var browserNameMap = {
|
|||||||
'iphone': 'iPhone'
|
'iphone': 'iPhone'
|
||||||
};
|
};
|
||||||
|
|
||||||
/** List of platforms to load the runner on */
|
/** List of platforms to load the runner on. */
|
||||||
var platforms = [
|
var platforms = [
|
||||||
//['Linux', 'android', '4.3'],
|
//['Linux', 'android', '4.3'],
|
||||||
//['Linux', 'android', '4.0'],
|
//['Linux', 'android', '4.0'],
|
||||||
@@ -125,12 +125,12 @@ var platforms = [
|
|||||||
['OS X 10.6', 'safari', '5']
|
['OS X 10.6', 'safari', '5']
|
||||||
];
|
];
|
||||||
|
|
||||||
/** Used to tailor the `platforms` array */
|
/** Used to tailor the `platforms` array. */
|
||||||
var runnerQuery = url.parse(runner, true).query,
|
var runnerQuery = url.parse(runner, true).query,
|
||||||
isBackbone = /\bbackbone\b/i.test(runner),
|
isBackbone = /\bbackbone\b/i.test(runner),
|
||||||
isModern = /\bmodern\b/i.test(runnerQuery.build);
|
isModern = /\bmodern\b/i.test(runnerQuery.build);
|
||||||
|
|
||||||
// platforms to test IE compat mode
|
// The platforms to test IE compatibility modes.
|
||||||
if (compatMode) {
|
if (compatMode) {
|
||||||
platforms = [
|
platforms = [
|
||||||
['Windows 8.1', 'internet explorer', '11'],
|
['Windows 8.1', 'internet explorer', '11'],
|
||||||
@@ -139,7 +139,7 @@ if (compatMode) {
|
|||||||
['Windows 7', 'internet explorer', '8']
|
['Windows 7', 'internet explorer', '8']
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
// platforms for AMD tests
|
// The platforms for AMD tests.
|
||||||
if (_.contains(tags, 'amd')) {
|
if (_.contains(tags, 'amd')) {
|
||||||
platforms = _.filter(platforms, function(platform) {
|
platforms = _.filter(platforms, function(platform) {
|
||||||
var browser = browserName(platform[1]),
|
var browser = browserName(platform[1]),
|
||||||
@@ -152,7 +152,7 @@ if (_.contains(tags, 'amd')) {
|
|||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// platforms for Backbone tests
|
// The platforms for Backbone tests.
|
||||||
if (isBackbone) {
|
if (isBackbone) {
|
||||||
platforms = _.filter(platforms, function(platform) {
|
platforms = _.filter(platforms, function(platform) {
|
||||||
var browser = browserName(platform[1]),
|
var browser = browserName(platform[1]),
|
||||||
@@ -166,7 +166,7 @@ if (isBackbone) {
|
|||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// platforms for modern builds
|
// The platforms for modern builds.
|
||||||
if (isModern) {
|
if (isModern) {
|
||||||
platforms = _.filter(platforms, function(platform) {
|
platforms = _.filter(platforms, function(platform) {
|
||||||
var browser = browserName(platform[1]),
|
var browser = browserName(platform[1]),
|
||||||
@@ -184,7 +184,7 @@ if (isModern) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Used as the default `Job` options object */
|
/** Used as the default `Job` options object. */
|
||||||
var jobOptions = {
|
var jobOptions = {
|
||||||
'build': build,
|
'build': build,
|
||||||
'command-timeout': commandTimeout,
|
'command-timeout': commandTimeout,
|
||||||
@@ -298,7 +298,7 @@ function logThrobber() {
|
|||||||
* @returns {Array} Returns the new converted array.
|
* @returns {Array} Returns the new converted array.
|
||||||
*/
|
*/
|
||||||
function optionToArray(name, string) {
|
function optionToArray(name, string) {
|
||||||
return _.compact(_.invoke((optionToValue(name, string) || '').split(/, */), 'trim'));
|
return _.compact(_.invoke((optionToValue(name, string) || '').split(/,. */), 'trim'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -742,7 +742,7 @@ function Tunnel(properties) {
|
|||||||
if (!_.contains(restarted, this)) {
|
if (!_.contains(restarted, this)) {
|
||||||
restarted.push(this);
|
restarted.push(this);
|
||||||
}
|
}
|
||||||
// restart tunnel if all active jobs have restarted
|
// Restart tunnel if all active jobs have restarted.
|
||||||
var threshold = Math.min(all.length, _.isFinite(throttled) ? throttled : 3);
|
var threshold = Math.min(all.length, _.isFinite(throttled) ? throttled : 3);
|
||||||
if (tunnel.attempts < tunnel.retries &&
|
if (tunnel.attempts < tunnel.retries &&
|
||||||
active.length >= threshold && _.isEmpty(_.difference(active, restarted))) {
|
active.length >= threshold && _.isEmpty(_.difference(active, restarted))) {
|
||||||
@@ -896,22 +896,22 @@ Tunnel.prototype.stop = function(callback) {
|
|||||||
|
|
||||||
/*----------------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
// cleanup any inline logs when exited via `ctrl+c`
|
// Cleanup any inline logs when exited via `ctrl+c`.
|
||||||
process.on('SIGINT', function() {
|
process.on('SIGINT', function() {
|
||||||
logInline();
|
logInline();
|
||||||
process.exit();
|
process.exit();
|
||||||
});
|
});
|
||||||
|
|
||||||
// create a web server for the current working directory
|
// Create a web server for the current working directory.
|
||||||
http.createServer(function(req, res) {
|
http.createServer(function(req, res) {
|
||||||
// see http://msdn.microsoft.com/en-us/library/ff955275(v=vs.85).aspx
|
// See http://msdn.microsoft.com/en-us/library/ff955275(v=vs.85).aspx.
|
||||||
if (compatMode && path.extname(url.parse(req.url).pathname) == '.html') {
|
if (compatMode && path.extname(url.parse(req.url).pathname) == '.html') {
|
||||||
res.setHeader('X-UA-Compatible', 'IE=' + compatMode);
|
res.setHeader('X-UA-Compatible', 'IE=' + compatMode);
|
||||||
}
|
}
|
||||||
mount(req, res);
|
mount(req, res);
|
||||||
}).listen(port);
|
}).listen(port);
|
||||||
|
|
||||||
// set up Sauce Connect so we can use this server from Sauce Labs
|
// Setup Sauce Connect so we can use this server from Sauce Labs.
|
||||||
var tunnel = new Tunnel({
|
var tunnel = new Tunnel({
|
||||||
'user': username,
|
'user': username,
|
||||||
'pass': accessKey,
|
'pass': accessKey,
|
||||||
|
|||||||
134
test/test.js
134
test/test.js
@@ -1,35 +1,35 @@
|
|||||||
;(function() {
|
;(function() {
|
||||||
|
|
||||||
/** Used as a safe reference for `undefined` in pre ES5 environments */
|
/** Used as a safe reference for `undefined` in pre ES5 environments. */
|
||||||
var undefined;
|
var undefined;
|
||||||
|
|
||||||
/** Used to detect when a function becomes hot */
|
/** Used to detect when a function becomes hot. */
|
||||||
var HOT_COUNT = 150;
|
var HOT_COUNT = 150;
|
||||||
|
|
||||||
/** Used as the size to cover large array optimizations */
|
/** Used as the size to cover large array optimizations. */
|
||||||
var LARGE_ARRAY_SIZE = 200;
|
var LARGE_ARRAY_SIZE = 200;
|
||||||
|
|
||||||
/** Used as references for the max length and index of an array */
|
/** Used as references for the max length and index of an array. */
|
||||||
var MAX_ARRAY_LENGTH = Math.pow(2, 32) - 1,
|
var MAX_ARRAY_LENGTH = Math.pow(2, 32) - 1,
|
||||||
MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1;
|
MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1;
|
||||||
|
|
||||||
/** Used as the maximum length an array-like object */
|
/** Used as the maximum length an array-like object. */
|
||||||
var MAX_SAFE_INTEGER = Math.pow(2, 53) - 1;
|
var MAX_SAFE_INTEGER = Math.pow(2, 53) - 1;
|
||||||
|
|
||||||
/** Used as a reference to the global object */
|
/** Used as a reference to the global object. */
|
||||||
var root = (typeof global == 'object' && global) || this;
|
var root = (typeof global == 'object' && global) || this;
|
||||||
|
|
||||||
/** Used to store Lo-Dash to test for bad extensions/shims */
|
/** Used to store Lo-Dash to test for bad extensions/shims. */
|
||||||
var lodashBizarro = root.lodashBizarro;
|
var lodashBizarro = root.lodashBizarro;
|
||||||
|
|
||||||
/** Used for native method references */
|
/** Used for native method references. */
|
||||||
var arrayProto = Array.prototype,
|
var arrayProto = Array.prototype,
|
||||||
errorProto = Error.prototype,
|
errorProto = Error.prototype,
|
||||||
funcProto = Function.prototype,
|
funcProto = Function.prototype,
|
||||||
objectProto = Object.prototype,
|
objectProto = Object.prototype,
|
||||||
stringProto = String.prototype;
|
stringProto = String.prototype;
|
||||||
|
|
||||||
/** Method and object shortcuts */
|
/** Method and object shortcuts. */
|
||||||
var phantom = root.phantom,
|
var phantom = root.phantom,
|
||||||
amd = root.define && define.amd,
|
amd = root.define && define.amd,
|
||||||
argv = root.process && process.argv,
|
argv = root.process && process.argv,
|
||||||
@@ -49,7 +49,7 @@
|
|||||||
toString = objectProto.toString,
|
toString = objectProto.toString,
|
||||||
Uint8Array = root.Uint8Array;
|
Uint8Array = root.Uint8Array;
|
||||||
|
|
||||||
/** Used to set property descriptors */
|
/** Used to set property descriptors. */
|
||||||
var defineProperty = (function() {
|
var defineProperty = (function() {
|
||||||
try {
|
try {
|
||||||
var o = {},
|
var o = {},
|
||||||
@@ -59,7 +59,7 @@
|
|||||||
return result;
|
return result;
|
||||||
}());
|
}());
|
||||||
|
|
||||||
/** The file path of the Lo-Dash file to test */
|
/** The file path of the Lo-Dash file to test. */
|
||||||
var filePath = (function() {
|
var filePath = (function() {
|
||||||
var min = 0,
|
var min = 0,
|
||||||
result = [];
|
result = [];
|
||||||
@@ -90,7 +90,7 @@
|
|||||||
return result;
|
return result;
|
||||||
}());
|
}());
|
||||||
|
|
||||||
/** The `ui` object */
|
/** The `ui` object. */
|
||||||
var ui = root.ui || (root.ui = {
|
var ui = root.ui || (root.ui = {
|
||||||
'buildPath': filePath,
|
'buildPath': filePath,
|
||||||
'loaderPath': '',
|
'loaderPath': '',
|
||||||
@@ -99,41 +99,41 @@
|
|||||||
'urlParams': {}
|
'urlParams': {}
|
||||||
});
|
});
|
||||||
|
|
||||||
/** The basename of the Lo-Dash file to test */
|
/** The basename of the Lo-Dash file to test. */
|
||||||
var basename = /[\w.-]+$/.exec(filePath)[0];
|
var basename = /[\w.-]+$/.exec(filePath)[0];
|
||||||
|
|
||||||
/** Detect if in a Java environment */
|
/** Detect if in a Java environment. */
|
||||||
var isJava = !document && !!root.java;
|
var isJava = !document && !!root.java;
|
||||||
|
|
||||||
/** Used to indicate testing a modularized build */
|
/** Used to indicate testing a modularized build. */
|
||||||
var isModularize = ui.isModularize;
|
var isModularize = ui.isModularize;
|
||||||
|
|
||||||
/** Detect if testing `npm` modules */
|
/** Detect if testing `npm` modules. */
|
||||||
var isNpm = isModularize && /\bnpm\b/.test([ui.buildPath, ui.urlParams.build]);
|
var isNpm = isModularize && /\bnpm\b/.test([ui.buildPath, ui.urlParams.build]);
|
||||||
|
|
||||||
/** Detect if running in PhantomJS */
|
/** Detect if running in PhantomJS. */
|
||||||
var isPhantom = phantom || typeof callPhantom == 'function';
|
var isPhantom = phantom || typeof callPhantom == 'function';
|
||||||
|
|
||||||
/** Detect if running in Rhino */
|
/** Detect if running in Rhino. */
|
||||||
var isRhino = isJava && typeof global == 'function' && global().Array === root.Array;
|
var isRhino = isJava && typeof global == 'function' && global().Array === root.Array;
|
||||||
|
|
||||||
/** Detect if Lo-Dash is in strict mode */
|
/** Detect if Lo-Dash is in strict mode. */
|
||||||
var isStrict = ui.isStrict;
|
var isStrict = ui.isStrict;
|
||||||
|
|
||||||
/** Used to test Web Workers */
|
/** Used to test Web Workers. */
|
||||||
var Worker = !(ui.isForeign || ui.isSauceLabs || isModularize) && document && root.Worker;
|
var Worker = !(ui.isForeign || ui.isSauceLabs || isModularize) && document && root.Worker;
|
||||||
|
|
||||||
/** Used to test host objects in IE */
|
/** Used to test host objects in IE. */
|
||||||
try {
|
try {
|
||||||
var xml = new ActiveXObject('Microsoft.XMLDOM');
|
var xml = new ActiveXObject('Microsoft.XMLDOM');
|
||||||
} catch(e) {}
|
} catch(e) {}
|
||||||
|
|
||||||
/** Use a single "load" function */
|
/** Use a single "load" function. */
|
||||||
var load = (typeof require == 'function' && !amd)
|
var load = (typeof require == 'function' && !amd)
|
||||||
? require
|
? require
|
||||||
: (isJava && root.load) || noop;
|
: (isJava && root.load) || noop;
|
||||||
|
|
||||||
/** The unit testing framework */
|
/** The unit testing framework. */
|
||||||
var QUnit = (function() {
|
var QUnit = (function() {
|
||||||
return root.QUnit || (
|
return root.QUnit || (
|
||||||
root.addEventListener || (root.addEventListener = noop),
|
root.addEventListener || (root.addEventListener = noop),
|
||||||
@@ -144,7 +144,7 @@
|
|||||||
);
|
);
|
||||||
}());
|
}());
|
||||||
|
|
||||||
/** Load and install QUnit Extras and ES6 Set/WeakMap shims */
|
/** Load and install QUnit Extras and ES6 Set/WeakMap shims. */
|
||||||
(function() {
|
(function() {
|
||||||
var paths = [
|
var paths = [
|
||||||
'./asset/set.js',
|
'./asset/set.js',
|
||||||
@@ -165,11 +165,11 @@
|
|||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
// log params provided to `test.js`
|
// Log params provided to `test.js`.
|
||||||
if (params) {
|
if (params) {
|
||||||
console.log('test.js invoked with arguments: ' + JSON.stringify(slice.call(params)));
|
console.log('test.js invoked with arguments: ' + JSON.stringify(slice.call(params)));
|
||||||
}
|
}
|
||||||
// exit early if going to run tests in a PhantomJS web page
|
// Exit early if going to run tests in a PhantomJS web page.
|
||||||
if (phantom && isModularize) {
|
if (phantom && isModularize) {
|
||||||
var page = require('webpage').create();
|
var page = require('webpage').create();
|
||||||
page.open(filePath, function(status) {
|
page.open(filePath, function(status) {
|
||||||
@@ -211,14 +211,14 @@
|
|||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
/** The `lodash` function to test */
|
/** The `lodash` function to test. */
|
||||||
var _ = root._ || (root._ = (
|
var _ = root._ || (root._ = (
|
||||||
_ = load(filePath) || root._,
|
_ = load(filePath) || root._,
|
||||||
_ = _._ || (isStrict = ui.isStrict = isStrict || 'default' in _, _['default']) || _,
|
_ = _._ || (isStrict = ui.isStrict = isStrict || 'default' in _, _['default']) || _,
|
||||||
(_.runInContext ? _.runInContext(root) : _)
|
(_.runInContext ? _.runInContext(root) : _)
|
||||||
));
|
));
|
||||||
|
|
||||||
/** List of latin-1 supplementary letters to basic latin letters */
|
/** List of latin-1 supplementary letters to basic latin letters. */
|
||||||
var burredLetters = [
|
var burredLetters = [
|
||||||
'\xc0', '\xc1', '\xc2', '\xc3', '\xc4', '\xc5', '\xc6', '\xc7', '\xc8', '\xc9', '\xca', '\xcb', '\xcc', '\xcd', '\xce',
|
'\xc0', '\xc1', '\xc2', '\xc3', '\xc4', '\xc5', '\xc6', '\xc7', '\xc8', '\xc9', '\xca', '\xcb', '\xcc', '\xcd', '\xce',
|
||||||
'\xcf', '\xd0', '\xd1', '\xd2', '\xd3', '\xd4', '\xd5', '\xd6', '\xd8', '\xd9', '\xda', '\xdb', '\xdc', '\xdd', '\xde',
|
'\xcf', '\xd0', '\xd1', '\xd2', '\xd3', '\xd4', '\xd5', '\xd6', '\xd8', '\xd9', '\xda', '\xdb', '\xdc', '\xdd', '\xde',
|
||||||
@@ -226,7 +226,7 @@
|
|||||||
'\xef', '\xf0', '\xf1', '\xf2', '\xf3', '\xf4', '\xf5', '\xf6', '\xf8', '\xf9', '\xfa', '\xfb', '\xfc', '\xfd', '\xfe', '\xff'
|
'\xef', '\xf0', '\xf1', '\xf2', '\xf3', '\xf4', '\xf5', '\xf6', '\xf8', '\xf9', '\xfa', '\xfb', '\xfc', '\xfd', '\xfe', '\xff'
|
||||||
];
|
];
|
||||||
|
|
||||||
/** List of `burredLetters` translated to basic latin letters */
|
/** List of `burredLetters` translated to basic latin letters. */
|
||||||
var deburredLetters = [
|
var deburredLetters = [
|
||||||
'A', 'A', 'A', 'A', 'A', 'A', 'Ae', 'C', 'E', 'E', 'E', 'E', 'I', 'I', 'I',
|
'A', 'A', 'A', 'A', 'A', 'A', 'Ae', 'C', 'E', 'E', 'E', 'E', 'I', 'I', 'I',
|
||||||
'I', 'D', 'N', 'O', 'O', 'O', 'O', 'O', 'O', 'U', 'U', 'U', 'U', 'Y', 'Th',
|
'I', 'D', 'N', 'O', 'O', 'O', 'O', 'O', 'O', 'U', 'U', 'U', 'U', 'Y', 'Th',
|
||||||
@@ -234,13 +234,13 @@
|
|||||||
'i', 'd', 'n', 'o', 'o', 'o', 'o', 'o', 'o', 'u', 'u', 'u', 'u', 'y', 'th', 'y'
|
'i', 'd', 'n', 'o', 'o', 'o', 'o', 'o', 'o', 'u', 'u', 'u', 'u', 'y', 'th', 'y'
|
||||||
];
|
];
|
||||||
|
|
||||||
/** Used to provide falsey values to methods */
|
/** Used to provide falsey values to methods. */
|
||||||
var falsey = [, '', 0, false, NaN, null, undefined];
|
var falsey = [, '', 0, false, NaN, null, undefined];
|
||||||
|
|
||||||
/** Used to provide empty values to methods */
|
/** Used to provide empty values to methods. */
|
||||||
var empties = [[], {}].concat(falsey.slice(1));
|
var empties = [[], {}].concat(falsey.slice(1));
|
||||||
|
|
||||||
/** Used to test error objects */
|
/** Used to test error objects. */
|
||||||
var errors = [
|
var errors = [
|
||||||
new Error,
|
new Error,
|
||||||
new EvalError,
|
new EvalError,
|
||||||
@@ -251,7 +251,7 @@
|
|||||||
new URIError
|
new URIError
|
||||||
];
|
];
|
||||||
|
|
||||||
/** Used to check problem JScript properties (a.k.a. the `[[DontEnum]]` bug) */
|
/** Used to check problem JScript properties (a.k.a. the `[[DontEnum]]` bug). */
|
||||||
var shadowedProps = [
|
var shadowedProps = [
|
||||||
'constructor',
|
'constructor',
|
||||||
'hasOwnProperty',
|
'hasOwnProperty',
|
||||||
@@ -262,10 +262,10 @@
|
|||||||
'valueOf'
|
'valueOf'
|
||||||
];
|
];
|
||||||
|
|
||||||
/** Used to check problem JScript properties too */
|
/** Used to check problem JScript properties too. */
|
||||||
var shadowedObject = _.invert(shadowedProps);
|
var shadowedObject = _.invert(shadowedProps);
|
||||||
|
|
||||||
/** Used to check whether methods support typed arrays */
|
/** Used to check whether methods support typed arrays. */
|
||||||
var typedArrays = [
|
var typedArrays = [
|
||||||
'Float32Array',
|
'Float32Array',
|
||||||
'Float64Array',
|
'Float64Array',
|
||||||
@@ -360,13 +360,13 @@
|
|||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
// setup values for Node.js
|
// Setup values for Node.js.
|
||||||
(function() {
|
(function() {
|
||||||
if (amd) {
|
if (amd) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
// add values from a different realm
|
// Add values from a different realm.
|
||||||
_.extend(_, require('vm').runInNewContext([
|
_.extend(_, require('vm').runInNewContext([
|
||||||
'(function() {',
|
'(function() {',
|
||||||
' var object = {',
|
' var object = {',
|
||||||
@@ -408,14 +408,14 @@
|
|||||||
return _.constant(nativeString.replace(reToString, funcName));
|
return _.constant(nativeString.replace(reToString, funcName));
|
||||||
}
|
}
|
||||||
|
|
||||||
// expose `baseEach` for better code coverage
|
// Expose `baseEach` for better code coverage.
|
||||||
if (isModularize && !isNpm) {
|
if (isModularize && !isNpm) {
|
||||||
var path = require('path'),
|
var path = require('path'),
|
||||||
baseEach = require(path.join(path.dirname(filePath), 'internal', 'baseEach.js'));
|
baseEach = require(path.join(path.dirname(filePath), 'internal', 'baseEach.js'));
|
||||||
|
|
||||||
_._baseEach = baseEach.baseEach || baseEach['default'] || baseEach;
|
_._baseEach = baseEach.baseEach || baseEach['default'] || baseEach;
|
||||||
}
|
}
|
||||||
// allow bypassing native checks
|
// Allow bypassing native checks.
|
||||||
setProperty(funcProto, 'toString', function wrapper() {
|
setProperty(funcProto, 'toString', function wrapper() {
|
||||||
setProperty(funcProto, 'toString', fnToString);
|
setProperty(funcProto, 'toString', fnToString);
|
||||||
var result = _.has(this, 'toString') ? this.toString() : fnToString.call(this);
|
var result = _.has(this, 'toString') ? this.toString() : fnToString.call(this);
|
||||||
@@ -423,10 +423,10 @@
|
|||||||
return result;
|
return result;
|
||||||
});
|
});
|
||||||
|
|
||||||
// add extensions
|
// Add extensions.
|
||||||
funcProto._method = _.noop;
|
funcProto._method = _.noop;
|
||||||
|
|
||||||
// set bad shims
|
// Set bad shims.
|
||||||
var _isArray = Array.isArray;
|
var _isArray = Array.isArray;
|
||||||
setProperty(Array, 'isArray', _.noop);
|
setProperty(Array, 'isArray', _.noop);
|
||||||
|
|
||||||
@@ -512,23 +512,23 @@
|
|||||||
var _WeakMap = root.WeakMap;
|
var _WeakMap = root.WeakMap;
|
||||||
setProperty(root, 'WeakMap', _.noop);
|
setProperty(root, 'WeakMap', _.noop);
|
||||||
|
|
||||||
// fake DOM
|
// Fake the DOM
|
||||||
setProperty(root, 'window', {});
|
setProperty(root, 'window', {});
|
||||||
setProperty(root.window, 'document', {});
|
setProperty(root.window, 'document', {});
|
||||||
setProperty(root.window.document, 'createDocumentFragment', function() {
|
setProperty(root.window.document, 'createDocumentFragment', function() {
|
||||||
return { 'nodeType': 11 };
|
return { 'nodeType': 11 };
|
||||||
});
|
});
|
||||||
|
|
||||||
// fake `WinRTError`
|
// Fake `WinRTError`.
|
||||||
setProperty(root, 'WinRTError', Error);
|
setProperty(root, 'WinRTError', Error);
|
||||||
|
|
||||||
// clear cache so Lo-Dash can be reloaded
|
// Clear cache so Lo-Dash can be reloaded.
|
||||||
emptyObject(require.cache);
|
emptyObject(require.cache);
|
||||||
|
|
||||||
// load Lo-Dash and expose it to the bad extensions/shims
|
// Load Lo-Dash and expose it to the bad extensions/shims.
|
||||||
lodashBizarro = (lodashBizarro = require(filePath))._ || lodashBizarro['default'] || lodashBizarro;
|
lodashBizarro = (lodashBizarro = require(filePath))._ || lodashBizarro['default'] || lodashBizarro;
|
||||||
|
|
||||||
// restore native methods
|
// Restore native methods.
|
||||||
setProperty(Array, 'isArray', _isArray);
|
setProperty(Array, 'isArray', _isArray);
|
||||||
setProperty(Date, 'now', _now);
|
setProperty(Date, 'now', _now);
|
||||||
setProperty(Object, 'create', _create);
|
setProperty(Object, 'create', _create);
|
||||||
@@ -568,7 +568,7 @@
|
|||||||
delete funcProto._method;
|
delete funcProto._method;
|
||||||
}());
|
}());
|
||||||
|
|
||||||
// add values from an iframe
|
// Add values from an iframe.
|
||||||
(function() {
|
(function() {
|
||||||
if (_._object || !document) {
|
if (_._object || !document) {
|
||||||
return;
|
return;
|
||||||
@@ -607,7 +607,7 @@
|
|||||||
idoc.close();
|
idoc.close();
|
||||||
}());
|
}());
|
||||||
|
|
||||||
// add web worker
|
// Add a web worker.
|
||||||
(function() {
|
(function() {
|
||||||
if (!Worker) {
|
if (!Worker) {
|
||||||
return;
|
return;
|
||||||
@@ -622,8 +622,8 @@
|
|||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
// explicitly call `QUnit.module()` instead of `module()`
|
// Explicitly call `QUnit.module()` instead of `module()` in case we are
|
||||||
// in case we are in a CLI environment
|
// in a CLI environment.
|
||||||
QUnit.module(basename);
|
QUnit.module(basename);
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
@@ -1813,7 +1813,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('`_.' + methodName + '` should clone `lastIndex` regexp property', 1, function() {
|
test('`_.' + methodName + '` should clone `lastIndex` regexp property', 1, function() {
|
||||||
// avoid a regexp literal for older Opera and use `exec` for older Safari
|
// Avoid a regexp literal for older Opera and use `exec` for older Safari.
|
||||||
var regexp = RegExp('x', 'g');
|
var regexp = RegExp('x', 'g');
|
||||||
regexp.exec('vwxyz');
|
regexp.exec('vwxyz');
|
||||||
|
|
||||||
@@ -4182,7 +4182,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('should work with extremely large arrays', 3, function() {
|
test('should work with extremely large arrays', 3, function() {
|
||||||
// test in modern browsers
|
// Test in modern browsers only to avoid browser hangs.
|
||||||
if (freeze) {
|
if (freeze) {
|
||||||
var expected = Array(5e5);
|
var expected = Array(5e5);
|
||||||
|
|
||||||
@@ -6234,7 +6234,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('should return `true` for like-objects from different documents', 4, function() {
|
test('should return `true` for like-objects from different documents', 4, function() {
|
||||||
// ensure `_._object` is assigned (unassigned in Opera 10.00)
|
// Ensure `_._object` is assigned (unassigned in Opera 10.00).
|
||||||
if (_._object) {
|
if (_._object) {
|
||||||
strictEqual(_.isEqual({ 'a': 1, 'b': 2, 'c': 3 }, _._object), true);
|
strictEqual(_.isEqual({ 'a': 1, 'b': 2, 'c': 3 }, _._object), true);
|
||||||
strictEqual(_.isEqual({ 'a': 1, 'b': 2, 'c': 2 }, _._object), false);
|
strictEqual(_.isEqual({ 'a': 1, 'b': 2, 'c': 2 }, _._object), false);
|
||||||
@@ -6501,8 +6501,8 @@
|
|||||||
|
|
||||||
test('should work using its fallback', 3, function() {
|
test('should work using its fallback', 3, function() {
|
||||||
if (!isModularize) {
|
if (!isModularize) {
|
||||||
// simulate native `Uint8Array` constructor with a `[[Class]]`
|
// Simulate native `Uint8Array` constructor with a `[[Class]]`
|
||||||
// of 'Function' and a `typeof` result of 'object'
|
// of 'Function' and a `typeof` result of 'object'.
|
||||||
var lodash = _.runInContext({
|
var lodash = _.runInContext({
|
||||||
'Function': {
|
'Function': {
|
||||||
'prototype': {
|
'prototype': {
|
||||||
@@ -6542,8 +6542,8 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('should work with host objects in IE 8 document mode (test in IE 11)', 2, function() {
|
test('should work with host objects in IE 8 document mode (test in IE 11)', 2, function() {
|
||||||
// trigger Chakra bug
|
// Trigger a Chakra bug.
|
||||||
// https://github.com/jashkenas/underscore/issues/1621
|
// See https://github.com/jashkenas/underscore/issues/1621.
|
||||||
_.each([body, xml], function(object) {
|
_.each([body, xml], function(object) {
|
||||||
if (object) {
|
if (object) {
|
||||||
_.times(100, _.isFunction);
|
_.times(100, _.isFunction);
|
||||||
@@ -6824,14 +6824,14 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('should avoid V8 bug #2291 (test in Chrome 19-20)', 1, function() {
|
test('should avoid V8 bug #2291 (test in Chrome 19-20)', 1, function() {
|
||||||
// trigger V8 bug
|
// Trigger a V8 bug.
|
||||||
// http://code.google.com/p/v8/issues/detail?id=2291
|
// See http://code.google.com/p/v8/issues/detail?id=2291.
|
||||||
var object = {};
|
var object = {};
|
||||||
|
|
||||||
// 1: Useless comparison statement, this is half the trigger
|
// 1: Useless comparison statement, this is half the trigger.
|
||||||
object == object;
|
object == object;
|
||||||
|
|
||||||
// 2: Initial check with object, this is the other half of the trigger
|
// 2: Initial check with object, this is the other half of the trigger.
|
||||||
_.isObject(object);
|
_.isObject(object);
|
||||||
|
|
||||||
strictEqual(_.isObject('x'), false);
|
strictEqual(_.isObject('x'), false);
|
||||||
@@ -7114,7 +7114,7 @@
|
|||||||
deepEqual(func('abc').sort(), ['0', '1', '2']);
|
deepEqual(func('abc').sort(), ['0', '1', '2']);
|
||||||
|
|
||||||
if (!isKeys) {
|
if (!isKeys) {
|
||||||
// IE 9 doesn't box numbers in for-in loops
|
// IE 9 doesn't box numbers in for-in loops.
|
||||||
Number.prototype.a = 1;
|
Number.prototype.a = 1;
|
||||||
deepEqual(func(0).sort(), ['a']);
|
deepEqual(func(0).sort(), ['a']);
|
||||||
delete Number.prototype.a;
|
delete Number.prototype.a;
|
||||||
@@ -10876,7 +10876,7 @@
|
|||||||
|
|
||||||
array.length = length;
|
array.length = length;
|
||||||
|
|
||||||
// avoid false fail in older Firefox
|
// Avoid false fails in older Firefox.
|
||||||
if (array.length == length) {
|
if (array.length == length) {
|
||||||
var actual = func(array, undefined, function() { steps++; });
|
var actual = func(array, undefined, function() { steps++; });
|
||||||
strictEqual(steps, 33);
|
strictEqual(steps, 33);
|
||||||
@@ -11177,7 +11177,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('should support single line comments in "evaluate" delimiters (test production builds)', 1, function() {
|
test('should support single line comments in "evaluate" delimiters (test production builds)', 1, function() {
|
||||||
var compiled = _.template('<% // comment %><% if (value) { %>yap<% } else { %>nope<% } %>'),
|
var compiled = _.template('<% // A code comment. %><% if (value) { %>yap<% } else { %>nope<% } %>'),
|
||||||
data = { 'value': true };
|
data = { 'value': true };
|
||||||
|
|
||||||
strictEqual(compiled(data), 'yap');
|
strictEqual(compiled(data), 'yap');
|
||||||
@@ -11304,7 +11304,7 @@
|
|||||||
|
|
||||||
test('should work with templates containing newlines and comments', 1, function() {
|
test('should work with templates containing newlines and comments', 1, function() {
|
||||||
var compiled = _.template('<%\n\
|
var compiled = _.template('<%\n\
|
||||||
// comment\n\
|
// A code comment.\n\
|
||||||
if (value) { value += 3; }\n\
|
if (value) { value += 3; }\n\
|
||||||
%><p><%= value %></p>'
|
%><p><%= value %></p>'
|
||||||
);
|
);
|
||||||
@@ -12177,7 +12177,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('`_.' + methodName + '` should not remove non-whitespace characters', 1, function() {
|
test('`_.' + methodName + '` should not remove non-whitespace characters', 1, function() {
|
||||||
// zero-width space (zws), next line character (nel), and non-character (bom) are not whitespace
|
// Zero-width space (zws), next line character (nel), and non-character (bom) are not whitespace.
|
||||||
var problemChars = '\x85\u200b\ufffe',
|
var problemChars = '\x85\u200b\ufffe',
|
||||||
string = problemChars + 'a b c' + problemChars;
|
string = problemChars + 'a b c' + problemChars;
|
||||||
|
|
||||||
@@ -13445,7 +13445,7 @@
|
|||||||
ok(pass, '`_.' + methodName + '` accepts falsey arguments');
|
ok(pass, '`_.' + methodName + '` accepts falsey arguments');
|
||||||
});
|
});
|
||||||
|
|
||||||
// skip tests for missing methods of modularized builds
|
// Skip tests for missing methods of modularized builds.
|
||||||
_.each(['chain', 'noConflict', 'runInContext'], function(methodName) {
|
_.each(['chain', 'noConflict', 'runInContext'], function(methodName) {
|
||||||
if (!_[methodName]) {
|
if (!_[methodName]) {
|
||||||
skipTest();
|
skipTest();
|
||||||
|
|||||||
Reference in New Issue
Block a user