diff --git a/README.md b/README.md index 923745b83d..06e15d91be 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Lo-Dash v1.0.0-rc.1 +# Lo-Dash v1.0.0-rc.2 [![build status](https://secure.travis-ci.org/bestiejs/lodash.png)](http://travis-ci.org/bestiejs/lodash) A utility library, usable as a drop-in replacement for Underscore, delivering [performance](http://lodash.com/benchmarks), [bug fixes](https://github.com/bestiejs/lodash#resolved-underscorejs-issues), and [additional features](http://lodash.com/#features). @@ -6,18 +6,18 @@ A utility library, usable as a drop-in replacement for Underscore, delivering [p ## Download * Lo-Dash builds:
-[Development](https://raw.github.com/bestiejs/lodash/v1.0.0-rc.1/lodash.js) and -[Production](https://raw.github.com/bestiejs/lodash/v1.0.0-rc.1/lodash.min.js) +[Development](https://raw.github.com/bestiejs/lodash/v1.0.0-rc.2/lodash.js) and +[Production](https://raw.github.com/bestiejs/lodash/v1.0.0-rc.2/lodash.min.js) * Underscore builds:
-[Development](https://raw.github.com/bestiejs/lodash/v1.0.0-rc.1/lodash.underscore.js) and -[Production](https://raw.github.com/bestiejs/lodash/v1.0.0-rc.1/lodash.underscore.min.js) +[Development](https://raw.github.com/bestiejs/lodash/v1.0.0-rc.2/lodash.underscore.js) and +[Production](https://raw.github.com/bestiejs/lodash/v1.0.0-rc.2/lodash.underscore.min.js) -* CDN copies of ≤ v1.0.0-rc.1’s builds are available on [cdnjs](http://cdnjs.com/) thanks to [CloudFlare](http://www.cloudflare.com/):
-[Lo-Dash development](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.0.0-rc.1/lodash.js), -[Lo-Dash production](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.0.0-rc.1/lodash.min.js), -[Underscore development](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.0.0-rc.1/lodash.underscore.js), and -[Underscore production](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.0.0-rc.1/lodash.underscore.min.js) +* CDN copies of ≤ v1.0.0-rc.2’s builds are available on [cdnjs](http://cdnjs.com/) thanks to [CloudFlare](http://www.cloudflare.com/):
+[Lo-Dash development](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.0.0-rc.2/lodash.js), +[Lo-Dash production](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.0.0-rc.2/lodash.min.js), +[Underscore development](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.0.0-rc.2/lodash.underscore.js), and +[Underscore production](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.0.0-rc.2/lodash.underscore.min.js) * For optimal file size, [create a custom build](https://github.com/bestiejs/lodash#custom-builds) with only the features you need @@ -43,6 +43,7 @@ For more information check out these screencasts over Lo-Dash: ## Features * AMD loader support ([RequireJS](http://requirejs.org/), [curl.js](https://github.com/cujojs/curl), etc.) + * [_(…)](http://lodash.com/docs#_) supports intuitive chaining without calling [_(…).chain](http://lodash.com/docs#prototype_chain) * [_.bindKey](http://lodash.com/docs#bindKey) for binding [*“lazy”* defined](http://michaux.ca/articles/lazy-function-definition-pattern) methods * [_.clone](http://lodash.com/docs#clone) supports *“deep”* cloning * [_.contains](http://lodash.com/docs#contains) accepts a `fromIndex` argument @@ -227,17 +228,22 @@ require({ ## Resolved Underscore.js issues - * Allow iteration of objects with a `length` property [[#799](https://github.com/documentcloud/underscore/pull/799), [test](https://github.com/bestiejs/lodash/blob/v1.0.0-rc.1/test/test.js#L605-L611)] - * Fix cross-browser object iteration bugs [[#60](https://github.com/documentcloud/underscore/issues/60), [#376](https://github.com/documentcloud/underscore/issues/376), [test](https://github.com/bestiejs/lodash/blob/v1.0.0-rc.1/test/test.js#L618-L642)] - * Methods should work on pages with incorrectly shimmed native methods [[#7](https://github.com/documentcloud/underscore/issues/7), [#742](https://github.com/documentcloud/underscore/issues/742), [test](https://github.com/bestiejs/lodash/blob/v1.0.0-rc.1/test/test.js#L140-L146)] - * `_.isEmpty` should support jQuery/MooTools DOM query collections [[#690](https://github.com/documentcloud/underscore/pull/690), [test](https://github.com/bestiejs/lodash/blob/v1.0.0-rc.1/test/test.js#L807-L812)] - * `_.isObject` should avoid V8 bug [#2291](http://code.google.com/p/v8/issues/detail?id=2291) [[#605](https://github.com/documentcloud/underscore/issues/605), [test](https://github.com/bestiejs/lodash/blob/v1.0.0-rc.1/test/test.js#L888-L900)] - * `_.keys` should work with `arguments` objects cross-browser [[#396](https://github.com/documentcloud/underscore/issues/396), [test](https://github.com/bestiejs/lodash/blob/v1.0.0-rc.1/test/test.js#L981-L983)] - * `_.range` should coerce arguments to numbers [[#634](https://github.com/documentcloud/underscore/issues/634), [#683](https://github.com/documentcloud/underscore/issues/683), [test](https://github.com/bestiejs/lodash/blob/v1.0.0-rc.1/test/test.js#L1382-L1385)] + * Allow iteration of objects with a `length` property [[#799](https://github.com/documentcloud/underscore/pull/799), [test](https://github.com/bestiejs/lodash/blob/v1.0.0-rc.2/test/test.js#L605-L611)] + * Fix cross-browser object iteration bugs [[#60](https://github.com/documentcloud/underscore/issues/60), [#376](https://github.com/documentcloud/underscore/issues/376), [test](https://github.com/bestiejs/lodash/blob/v1.0.0-rc.2/test/test.js#L618-L642)] + * Methods should work on pages with incorrectly shimmed native methods [[#7](https://github.com/documentcloud/underscore/issues/7), [#742](https://github.com/documentcloud/underscore/issues/742), [test](https://github.com/bestiejs/lodash/blob/v1.0.0-rc.2/test/test.js#L140-L146)] + * `_.isEmpty` should support jQuery/MooTools DOM query collections [[#690](https://github.com/documentcloud/underscore/pull/690), [test](https://github.com/bestiejs/lodash/blob/v1.0.0-rc.2/test/test.js#L807-L812)] + * `_.isObject` should avoid V8 bug [#2291](http://code.google.com/p/v8/issues/detail?id=2291) [[#605](https://github.com/documentcloud/underscore/issues/605), [test](https://github.com/bestiejs/lodash/blob/v1.0.0-rc.2/test/test.js#L888-L900)] + * `_.keys` should work with `arguments` objects cross-browser [[#396](https://github.com/documentcloud/underscore/issues/396), [test](https://github.com/bestiejs/lodash/blob/v1.0.0-rc.2/test/test.js#L981-L983)] + * `_.range` should coerce arguments to numbers [[#634](https://github.com/documentcloud/underscore/issues/634), [#683](https://github.com/documentcloud/underscore/issues/683), [test](https://github.com/bestiejs/lodash/blob/v1.0.0-rc.2/test/test.js#L1382-L1385)] ## Release Notes -### v1.0.0-rc.1 +### v1.0.0-rc.2 ### + + * Specified more method chaining behaviors + * Updated `underscore` build compatibility to v1.4.3 + +### v1.0.0-rc.1 ### #### Compatibility Warnings #### diff --git a/build.js b/build.js index 7e507e933c..e3c447ab44 100755 --- a/build.js +++ b/build.js @@ -124,7 +124,7 @@ 'memoize': [], 'merge': ['forOwn', 'isArray', 'isPlainObject'], 'min': ['forEach', 'isArray', 'isString'], - 'mixin': ['filter', 'forEach', 'functions'], + 'mixin': ['forEach', 'forOwn', 'functions'], 'noConflict': [], 'object': [], 'omit': ['forIn', 'indexOf'], @@ -366,6 +366,8 @@ .replace(/(?:(?:\s*\/\/.*)*\s*lodash\._[^=]+=.+\n)+/g, '\n') // remove lines with just whitespace and semicolons .replace(/^ *;\n/gm, '') + // consolidate multiple newlines + .replace(/\n{3,}/g, '\n\n') // consolidate consecutive horizontal rule comment separators .replace(/(?:\s*\/\*-+\*\/\s*){2,}/g, function(separators) { return separators.match(/^\s*/)[0] + separators.slice(separators.lastIndexOf('/*')); @@ -439,7 +441,7 @@ * @returns {String} Returns the method assignments snippet. */ function getMethodAssignments(source) { - return (source.match(/lodash\.VERSION *= *[\s\S]+?\/\*-+\*\/\n/) || [''])[0]; + return (source.match(/\/\*-+\*\/\n(?:\s*\/\/.*)*\s*lodash\.\w+ *=[\s\S]+?lodash\.VERSION *=.+/) || [''])[0]; } /** @@ -841,7 +843,7 @@ // clip snippet after the JSDoc comment block match = match.replace(/^\s*(?:\/\/.*|\/\*[^*]*\*+(?:[^\/][^*]*\*+)*\/)\n/, ''); source = source.replace(match, function() { - return funcValue; + return funcValue.trimRight() + '\n'; }); } return source; @@ -1313,13 +1315,6 @@ ' }' ].join('\n')); - // replace `_.isFinite` - source = replaceFunction(source, 'isFinite', [ - ' function isFinite(value) {', - ' return nativeIsFinite(value) && toString.call(value) == numberClass;', - ' }' - ].join('\n')); - // replace `_.omit` source = replaceFunction(source, 'omit', [ ' function omit(object) {', @@ -1412,6 +1407,11 @@ ' result = [],', ' seen = result;', '', + " if (typeof isSorted == 'function') {", + ' thisArg = callback;', + ' callback = isSorted;', + ' isSorted = false;', + ' }', ' if (callback) {', ' seen = [];', ' callback = createCallback(callback, thisArg);', @@ -1437,7 +1437,7 @@ // replace `_.uniqueId` source = replaceFunction(source, 'uniqueId', [ ' function uniqueId(prefix) {', - ' var id = idCounter++;', + " var id = ++idCounter + '';", ' return prefix ? prefix + id : id;', ' }' ].join('\n')); @@ -1467,17 +1467,22 @@ ' }' ].join('\n')); - // add `__chain__` checks to `_.mixin` and Array function wrappers - source = source.replace(/^( *)forEach\([\s\S]+?\n\1}.+/gm, function(match) { - return match.replace(/^( *)return new lodash\(([^)]+)\).+/m, function(submatch, indent, varName) { - return indent + [ - 'if (this.__chain__) {', - ' varName = new lodash(varName);', - ' varName.__chain__ = true;', - '}', - 'return varName;' - ].join('\n' + indent) - .replace(/varName/g, varName); + // add `__chain__` checks to `_.mixin` and `Array` function wrappers + _.each([ + matchFunction(source, 'mixin'), + /(?:\s*\/\/.*)*\n( *)forEach\(\['[\s\S]+?\n\1}.+/g + ], function(pattern) { + source = source.replace(pattern, function(match) { + return match.replace(/( *)return new lodash\(([^)]+)\).+/, function(submatch, indent, varName) { + return indent + [ + 'if (this.__chain__) {', + ' varName = new lodash(varName);', + ' varName.__chain__ = true;', + '}', + 'return varName;' + ].join('\n' + indent) + .replace(/varName/g, varName); + }); }); }); @@ -1494,12 +1499,21 @@ }); // remove `lodash.prototype.toString` and `lodash.prototype.valueOf` assignments - source = source.replace(/ *lodash\.prototype\.(?:toString|valueOf) *=.+\n/g, ''); + source = source.replace(/^ *lodash\.prototype\.(?:toString|valueOf) *=.+\n/gm, ''); // remove `lodash.prototype` batch method assignments - source = source - .replace(/(?:\s*\/\/.*)*\n( *)forEach\(\['first'[\s\S]+?\n\1}.+/, '') - .replace(/(?:\s*\/\/.*)*\n( *)forEach\(filter[\s\S]+?lodash\.[\s\S]+?\n\1}.+/, ''); + source = source.replace(/(?:\s*\/\/.*)*\n( *)forOwn\(lodash, *function\(func, *methodName\)[\s\S]+?\n\1}.+/g, ''); + + // move `mixin(lodash)` to after the method assignments + source = source.replace(/(?:\s*\/\/.*)*\s*mixin\(lodash\).+/, ''); + source = source.replace(getMethodAssignments(source), function(match) { + return match + [ + '', + '', + ' // add functions to `lodash.prototype`', + ' mixin(lodash);' + ].join('\n'); + }); // remove unused features from `createBound` if (buildMethods.indexOf('partial') == -1) { @@ -1619,23 +1633,23 @@ modified = snippet; if (!exposeAssign) { - modified = modified.replace(/(?:\n *\/\/.*\s*)* *lodash\.assign *= *.+\n/, ''); + modified = modified.replace(/^(?: *\/\/.*\s*)* *lodash\.assign *= *.+\n/m, ''); } if (!exposeForIn) { - modified = modified.replace(/(?:\n *\/\/.*\s*)* *lodash\.forIn *= *.+\n/, ''); + modified = modified.replace(/^(?: *\/\/.*\s*)* *lodash\.forIn *= *.+\n/m, ''); } if (!exposeForOwn) { - modified = modified.replace(/(?:\n *\/\/.*\s*)* *lodash\.forOwn *= *.+\n/, ''); + modified = modified.replace(/^(?: *\/\/.*\s*)* *lodash\.forOwn *= *.+\n/m, ''); } if (!exposeIsPlainObject) { - modified = modified.replace(/(?:\n *\/\/.*\s*)* *lodash\.isPlainObject *= *.+\n/, ''); + modified = modified.replace(/^(?: *\/\/.*\s*)* *lodash\.isPlainObject *= *.+\n/m, ''); } source = source.replace(snippet, modified); }()); // replace `isArguments` and its fallback (function() { - var snippet = matchFunction(source, 'isArguments'); + var snippet = matchFunction(source, 'isArguments').trimRight(); snippet = snippet.replace(/function isArguments/, 'lodash.isArguments = function'); source = removeFunction(source, 'isArguments'); @@ -1821,6 +1835,8 @@ source = removeIsFunctionFallback(source); } if (isRemoved(source, 'mixin')) { + source = removeVar(source, 'hasObjectSpliceBug'); + // simplify the `lodash` function source = replaceFunction(source, 'lodash', [ ' function lodash() {', @@ -1828,17 +1844,17 @@ ' }' ].join('\n')); - // remove `lodash.prototype` additions - source = source.replace(/(?:\s*\/\/.*)*\s*mixin\(lodash\)[\s\S]+?\/\*-+\*\//, ''); - source = removeVar(source, 'hasObjectSpliceBug'); + // remove all `lodash.prototype` additions + source = source + .replace(/(?:\s*\/\/.*)*\n( *)forOwn\(lodash, *function\(func, *methodName\)[\s\S]+?\n\1}.+/g, '') + .replace(/(?:\s*\/\/.*)*\n( *)forEach\(\['[\s\S]+?\n\1}.+/g, '') + .replace(/(?:\s*\/\/.*)*\s*mixin\(lodash\).+\n/, '') + .replace(/(?:\s*\/\/.*)*\s*lodash\.prototype.+\n/, ''); } - // remove pseudo private properties - source = source.replace(/(?:(?:\s*\/\/.*)*\s*lodash\._[^=]+=.+\n)+/g, '\n'); - // assign debug source before further modifications that rely on the minifier // to remove unused variables and other dead code - debugSource = source; + debugSource = cleanupSource(source); // remove associated functions, variables, and code snippets that the minifier may miss if (isRemoved(source, 'clone')) { @@ -1891,6 +1907,8 @@ } } + source = cleanupSource(source); + /*------------------------------------------------------------------------*/ // used to specify creating a custom build diff --git a/build/post-compile.js b/build/post-compile.js index 002ab58609..4d7ba68b8d 100644 --- a/build/post-compile.js +++ b/build/post-compile.js @@ -10,7 +10,7 @@ 'lodash': '/*!\n' + ' Lo-Dash @VERSION lodash.com/license\n' + - ' Underscore.js 1.4.2 underscorejs.org/LICENSE\n' + + ' Underscore.js 1.4.3 underscorejs.org/LICENSE\n' + '*/', 'underscore': '/*! Underscore.js @VERSION underscorejs.org/LICENSE */' diff --git a/doc/README.md b/doc/README.md index 8cd0114ada..b85a94e74d 100644 --- a/doc/README.md +++ b/doc/README.md @@ -1,4 +1,4 @@ -# Lo-Dash v1.0.0-rc.1 +# Lo-Dash v1.0.0-rc.2 @@ -3050,7 +3050,7 @@ _.uniqueId(); ### `_.VERSION` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4168 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4318 "View in source") [Ⓣ][1] *(String)*: The semantic version number. diff --git a/doc/parse.php b/doc/parse.php index f48473c46d..7bca1f165f 100644 --- a/doc/parse.php +++ b/doc/parse.php @@ -21,7 +21,7 @@ // generate Markdown $markdown = docdown(array( 'path' => '../' . $file, - 'title' => 'Lo-Dash v1.0.0-rc.1', + 'title' => 'Lo-Dash v1.0.0-rc.2', 'toc' => 'categories', 'url' => 'https://github.com/bestiejs/lodash/blob/master/lodash.js' )); diff --git a/lodash.js b/lodash.js index fa85f7f190..1664a12964 100644 --- a/lodash.js +++ b/lodash.js @@ -1,7 +1,7 @@ /*! - * Lo-Dash 1.0.0-rc.1 + * Lo-Dash 1.0.0-rc.2 * (c) 2012 John-David Dalton - * Based on Underscore.js 1.4.2 + * Based on Underscore.js 1.4.3 * (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. * Available under MIT license */ @@ -4158,50 +4158,81 @@ /*--------------------------------------------------------------------------*/ - /** - * The semantic version number. - * - * @static - * @memberOf _ - * @type String - */ - lodash.VERSION = '1.0.0-rc.1'; - - // assign static methods + // add functions that return wrapped values when chaining lodash.assign = assign; - lodash.after = after; - lodash.bind = bind; lodash.bindAll = bindAll; - lodash.bindKey = bindKey; lodash.chain = chain; - lodash.clone = clone; lodash.compact = compact; - lodash.compose = compose; - lodash.contains = contains; lodash.countBy = countBy; - lodash.debounce = debounce; lodash.defaults = defaults; - lodash.defer = defer; - lodash.delay = delay; lodash.difference = difference; - lodash.escape = escape; - lodash.every = every; lodash.filter = filter; - lodash.find = find; - lodash.first = first; lodash.flatten = flatten; lodash.forEach = forEach; lodash.forIn = forIn; lodash.forOwn = forOwn; lodash.functions = functions; lodash.groupBy = groupBy; - lodash.has = has; - lodash.identity = identity; - lodash.indexOf = indexOf; lodash.initial = initial; lodash.intersection = intersection; lodash.invert = invert; lodash.invoke = invoke; + lodash.keys = keys; + lodash.map = map; + lodash.max = max; + lodash.merge = merge; + lodash.min = min; + lodash.object = object; + lodash.omit = omit; + lodash.pairs = pairs; + lodash.pick = pick; + lodash.pluck = pluck; + lodash.range = range; + lodash.reject = reject; + lodash.rest = rest; + lodash.shuffle = shuffle; + lodash.sortBy = sortBy; + lodash.tap = tap; + lodash.times = times; + lodash.toArray = toArray; + lodash.union = union; + lodash.uniq = uniq; + lodash.values = values; + lodash.where = where; + lodash.without = without; + lodash.zip = zip; + + // add aliases + lodash.collect = map; + lodash.drop = rest; + lodash.each = forEach; + lodash.extend = assign; + lodash.methods = functions; + lodash.select = filter; + lodash.tail = rest; + lodash.unique = uniq; + + // add functions to `lodash.prototype` + mixin(lodash); + + /*--------------------------------------------------------------------------*/ + + // add functions that return unwrapped values when chaining + lodash.after = after; + lodash.bind = bind; + lodash.bindKey = bindKey; + lodash.clone = clone; + lodash.compose = compose; + lodash.contains = contains; + lodash.debounce = debounce; + lodash.defer = defer; + lodash.delay = delay; + lodash.escape = escape; + lodash.every = every; + lodash.find = find; + lodash.has = has; + lodash.identity = identity; + lodash.indexOf = indexOf; lodash.isArguments = isArguments; lodash.isArray = isArray; lodash.isBoolean = isBoolean; @@ -4219,120 +4250,89 @@ lodash.isRegExp = isRegExp; lodash.isString = isString; lodash.isUndefined = isUndefined; - lodash.keys = keys; - lodash.last = last; lodash.lastIndexOf = lastIndexOf; - lodash.map = map; - lodash.max = max; lodash.memoize = memoize; - lodash.merge = merge; - lodash.min = min; lodash.mixin = mixin; lodash.noConflict = noConflict; - lodash.object = object; - lodash.omit = omit; lodash.once = once; - lodash.pairs = pairs; lodash.partial = partial; - lodash.pick = pick; - lodash.pluck = pluck; lodash.random = random; - lodash.range = range; lodash.reduce = reduce; lodash.reduceRight = reduceRight; - lodash.reject = reject; - lodash.rest = rest; lodash.result = result; - lodash.shuffle = shuffle; lodash.size = size; lodash.some = some; - lodash.sortBy = sortBy; lodash.sortedIndex = sortedIndex; - lodash.tap = tap; lodash.template = template; lodash.throttle = throttle; - lodash.times = times; - lodash.toArray = toArray; lodash.unescape = unescape; - lodash.union = union; - lodash.uniq = uniq; lodash.uniqueId = uniqueId; - lodash.values = values; - lodash.where = where; - lodash.without = without; lodash.wrap = wrap; - lodash.zip = zip; - // assign aliases + // add aliases lodash.all = every; lodash.any = some; - lodash.collect = map; lodash.detect = find; - lodash.drop = rest; - lodash.each = forEach; - lodash.extend = assign; lodash.foldl = reduce; lodash.foldr = reduceRight; - lodash.head = first; lodash.include = contains; lodash.inject = reduce; - lodash.methods = functions; - lodash.select = filter; - lodash.tail = rest; - lodash.take = first; - lodash.unique = uniq; - // add pseudo private property to be used and removed during the build process - lodash._iteratorTemplate = iteratorTemplate; + forOwn(lodash, function(func, methodName) { + if (!lodash.prototype[methodName]) { + lodash.prototype[methodName] = function() { + var args = [this.__wrapped__]; + push.apply(args, arguments); + return func.apply(lodash, args); + }; + } + }); /*--------------------------------------------------------------------------*/ - // add all static functions to `lodash.prototype` - mixin(lodash); + // add functions capable of returning wrapped and unwrapped values when chaining + lodash.first = first; + lodash.last = last; - // add `lodash.prototype.chain` after calling `mixin()` to avoid overwriting - // it with the wrapped `lodash.chain` - lodash.prototype.chain = wrapperChain; - lodash.prototype.toString = wrapperToString; - lodash.prototype.value = wrapperValueOf; - lodash.prototype.valueOf = wrapperValueOf; + // add aliases + lodash.take = first; + lodash.head = first; - // add methods that are capable of returning wrapped and unwrapped values - forEach(['first', 'last'], function(methodName) { - var func = lodash[methodName]; - if (func) { - lodash.prototype[methodName] = function(n, guard) { + forOwn(lodash, function(func, methodName) { + if (!lodash.prototype[methodName]) { + lodash.prototype[methodName]= function(n, guard) { var result = func(this.__wrapped__, n, guard); - return (n == null || guard) - ? result - : new lodash(result); + return (n == null || guard) ? result : new lodash(result); }; } }); - // add all methods that return unwrapped values - forEach(filter(functions(lodash), function(methodName) { - return /^(?:bind|contains|every|find|has|is[A-Z].+|reduce.*|some)$/.test(methodName); - }), function(methodName) { - var func = lodash[methodName]; + /*--------------------------------------------------------------------------*/ - lodash.prototype[methodName] = function() { - var args = [this.__wrapped__]; - push.apply(args, arguments); - return func.apply(lodash, args); - }; - }); + /** + * The semantic version number. + * + * @static + * @memberOf _ + * @type String + */ + lodash.VERSION = '1.0.0-rc.2'; + + // add "Chaining" functions to the wrapper + lodash.prototype.chain = wrapperChain; + lodash.prototype.toString = wrapperToString; + lodash.prototype.value = wrapperValueOf; + lodash.prototype.valueOf = wrapperValueOf; - // add all mutator Array functions to the wrapper. + // add mutator `Array` functions to the wrapper forEach(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(methodName) { var func = arrayRef[methodName]; - lodash.prototype[methodName] = function() { var value = this.__wrapped__; func.apply(value, arguments); - // avoid array-like object bugs with `Array#shift` and `Array#splice` in - // Firefox < 10 and IE < 9 + // avoid array-like object bugs with `Array#shift` and `Array#splice` + // in Firefox < 10 and IE < 9 if (hasObjectSpliceBug && value.length === 0) { delete value[0]; } @@ -4340,10 +4340,9 @@ }; }); - // add all accessor Array functions to the wrapper. + // add accessor `Array` functions to the wrapper forEach(['concat', 'join', 'slice'], function(methodName) { var func = arrayRef[methodName]; - lodash.prototype[methodName] = function() { var value = this.__wrapped__, result = func.apply(value, arguments); @@ -4352,6 +4351,9 @@ }; }); + // add pseudo private property to be used and removed during the build process + lodash._iteratorTemplate = iteratorTemplate; + /*--------------------------------------------------------------------------*/ // expose Lo-Dash diff --git a/lodash.min.js b/lodash.min.js index 19c70c791f..acde0a7488 100644 --- a/lodash.min.js +++ b/lodash.min.js @@ -1,6 +1,6 @@ /*! - Lo-Dash 1.0.0-rc.1 lodash.com/license - Underscore.js 1.4.2 underscorejs.org/LICENSE + Lo-Dash 1.0.0-rc.2 lodash.com/license + Underscore.js 1.4.3 underscorejs.org/LICENSE */ ;(function(e,t){function s(e){if(e&&"object"==typeof e&&e.__wrapped__)return e;if(!(this instanceof s))return new s(e);this.__wrapped__=e}function o(t,n){return e.eval("(function("+t+"){"+n+"})")}function u(e,t,n){t||(t=0);var r=e.length,i=r-t>=(n||it);if(i)for(var s={},n=t-1;++nt||"undefined"==typeof e)return 1;if(en?Dt(0,i+n):n||0)-1;else if(n)return r=V(e,t),e[r]===t?r:-1;for(;++r/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:vt,variable:""};if(Xt||Vt||!Wt)o=Function;var an={a:"o,v,g",k:"for(var a=1,b=typeof g=='number'?2:arguments.length;a":">",'"':""","'":"'"},vn=T(dn),mn=h(an,{g:"if(t[i]==null)"+an.g}),gn=At||function(e){return kt.call(e)==jt};C(/x/)&&(C=function(e){return"[object Function]"==kt.call(e)});var yn=xt?function(e){if(!e||"object"!=typeof -e)return i;var t=e.valueOf,n="function"==typeof t&&(n=xt(t))&&xt(n);return n?e==n||xt(e)==n&&!b(e):w(e)}:w,bn=_t?function(e){return"function"==typeof e&&Ct.call(e,"prototype")?E(e):k(e)?_t(e):[]}:E,wn=h(fn);s.VERSION="1.0.0-rc.1",s.assign=cn,s.after=function(e,t){return 1>e?t():function(){if(1>--e)return t.apply(this,arguments)}},s.bind=J,s.bindAll=function(e){for(var t=arguments,n=1W(i,e)){for(var s=n;--s;)if(! -(r[s]||(r[s]=u(t[s])))(e))return;i.push(e)}}),i},s.invert=T,s.invoke=function(e,t){var n=g(arguments,2),r="function"==typeof t,i=[];return wn(e,function(e){i.push((r?t:e[t]).apply(e,n))}),i},s.isArguments=b,s.isArray=gn,s.isBoolean=function(e){return e===n||e===i||kt.call(e)==Ft},s.isDate=function(e){return kt.call(e)==It},s.isElement=function(e){return e?1===e.nodeType:i},s.isEmpty=function(e){var t=n;if(!e)return t;var r=kt.call(e),s=e.length;return r==jt||r==zt||r==Bt||Zt&&b(e)||r==Rt&&"number"==typeof -s&&C(e.splice)?!s:(pn(e,function(){return t=i}),t)},s.isEqual=N,s.isFinite=function(e){return Ot(e)&&!Mt(parseFloat(e))},s.isFunction=C,s.isNaN=function(e){return L(e)&&e!=+e},s.isNull=function(e){return e===r},s.isNumber=L,s.isObject=k,s.isPlainObject=yn,s.isRegExp=function(e){return kt.call(e)==Ut},s.isString=A,s.isUndefined=function(e){return"undefined"==typeof e},s.keys=bn,s.last=function(e,t,n){if(e){var i=e.length;return t==r||n?e[i-1]:g(e,Dt(0,i-t))}},s.lastIndexOf=function(e,t,n){var r=e? -e.length:0;for("number"==typeof n&&(r=(0>n?Dt(0,r+n):Pt(n,r-1))+1);r--;)if(e[r]===t)return r;return-1},s.map=B,s.max=j,s.memoize=function(e,t){var n={};return function(){var r=t?t.apply(this,arguments):arguments[0];return Tt.call(n,r)?n[r]:n[r]=e.apply(this,arguments)}},s.merge=O,s.min=function(e,t,n){var r=Infinity,i=-1,s=e?e.length:0,o=r;if(t||!gn(e))t=!t&&A(e)?a:c(t,n),wn(e,function(e,n,i){n=t(e,n,i),nW(s,n,1))i[n]=e}),i},s.once=function(e){var t,s=i;return function(){return s?t:(s=n,t=e.apply(this,arguments),e=r,t)}},s.pairs=function(e){var t=[];return pn(e,function(e,n){t.push([n,e])}),t},s.partial=function(e){return l -(e,g(arguments,1))},s.pick=function(e,t,n){var r={};if("function"!=typeof t)for(var i=0,s=Et.apply(et,arguments),o=s.length;++i=l?(clearTimeout(u),u=r,a=f,s=e.apply(o,i)):u||(u=setTimeout(n,l)),s}},s.times=function(e,t,n){for(var e=+e||0,r=-1,i=Array(e);++rW(i,e)){for(var s=n;--s;)if(!(r[s]||(r[s]=u(t[s])))(e))return;i.push(e)}}),i},s.invert=T,s.invoke=function(e,t){var n=g(arguments,2),r="function"==typeof t,i=[];return wn(e,function(e){i.push((r?t:e[t]).apply(e,n))}),i},s.keys=bn,s.map=B,s.max=j,s.merge=O,s.min=function(e,t,n){var r=Infinity,i=-1,s=e?e.length:0,o=r;if(t||!gn(e))t=!t&&A(e)?a:c(t,n),wn(e,function(e,n,i) +{n=t(e,n,i),nW(s,n,1))i[n]=e}),i},s.pairs=function(e){var t=[];return pn(e,function(e,n){t.push([n,e])}),t},s.pick=function(e,t,n){var r={};if("function"!=typeof t)for(var i=0,s=Et.apply +(et,arguments),o=s.length;++ie?t():function(){if(1>--e)return t.apply(this,arguments)}},s.bind=J,s.bindKey=function(e,t){return l(e,t,g +(arguments,2))},s.clone=S,s.compose=function(){var e=arguments;return function(){for(var t=arguments,n=e.length;n--;)t=[e[n].apply(this,t)];return t[0]}},s.contains=_,s.debounce=function(e,t,n){function i(){a=r,n||(o=e.apply(u,s))}var s,o,u,a;return function(){var r=n&&!a;return s=arguments,u=this,clearTimeout(a),a=setTimeout(i,t),r&&(o=e.apply(u,s)),o}},s.defer=function(e){var n=g(arguments,1);return setTimeout(function(){e.apply(t,n)},1)},s.delay=function(e,n){var r=g(arguments,2);return setTimeout +(function(){e.apply(t,r)},n)},s.escape=function(e){return e==r?"":(e+"").replace(gt,d)},s.every=D,s.find=H,s.has=function(e,t){return e?Tt.call(e,t):i},s.identity=K,s.indexOf=W,s.isArguments=b,s.isArray=gn,s.isBoolean=function(e){return e===n||e===i||kt.call(e)==Ft},s.isDate=function(e){return kt.call(e)==It},s.isElement=function(e){return e?1===e.nodeType:i},s.isEmpty=function(e){var t=n;if(!e)return t;var r=kt.call(e),s=e.length;return r==jt||r==zt||r==Bt||Zt&&b(e)||r==Rt&&"number"==typeof s&&C +(e.splice)?!s:(pn(e,function(){return t=i}),t)},s.isEqual=N,s.isFinite=function(e){return Ot(e)&&!Mt(parseFloat(e))},s.isFunction=C,s.isNaN=function(e){return L(e)&&e!=+e},s.isNull=function(e){return e===r},s.isNumber=L,s.isObject=k,s.isPlainObject=yn,s.isRegExp=function(e){return kt.call(e)==Ut},s.isString=A,s.isUndefined=function(e){return"undefined"==typeof e},s.lastIndexOf=function(e,t,n){var r=e?e.length:0;for("number"==typeof n&&(r=(0>n?Dt(0,r+n):Pt(n,r-1))+1);r--;)if(e[r]===t)return r;return-1 +},s.memoize=function(e,t){var n={};return function(){var r=t?t.apply(this,arguments):arguments[0];return Tt.call(n,r)?n[r]:n[r]=e.apply(this,arguments)}},s.mixin=Q,s.noConflict=function(){return e._=st,this},s.once=function(e){var t,s=i;return function(){return s?t:(s=n,t=e.apply(this,arguments),e=r,t)}},s.partial=function(e){return l(e,g(arguments,1))},s.random=function(e,t){return e==r&&t==r&&(t=1),e=+e||0,t==r&&(t=e,e=0),e+St(Ht()*((+t||0)-e+1))},s.reduce=I,s.reduceRight=q,s.result=function(e, +t){var n=e?e[t]:r;return C(n)?e[t]():n},s.size=function(e){var t=e?e.length:0;return"number"==typeof t?t:bn(e).length},s.some=R,s.sortedIndex=V,s.template=function(e,t,n){e||(e=""),n||(n={});var r,i,u=s.templateSettings,a=0,f=n.interpolate||u.interpolate||mt,l="__p+='",c=n.variable||u.variable,h=c;e.replace(RegExp((n.escape||u.escape||mt).source+"|"+f.source+"|"+(f===vt?dt:mt).source+"|"+(n.evaluate||u.evaluate||mt).source+"|$","g"),function(t,n,i,s,o,u){return i||(i=s),l+=e.slice(a,u).replace(yt +,p),n&&(l+="'+__e("+n+")+'"),o&&(l+="';"+o+";__p+='"),i&&(l+="'+((__t=("+i+"))==null?'':__t)+'"),r||(r=o||ot.test(n||i)),a=u+t.length,t}),l+="';\n",h||(c="obj",r?l="with("+c+"){"+l+"}":(n=RegExp("(\\(\\s*)"+c+"\\."+c+"\\b","g"),l=l.replace(ht,"$&"+c+".").replace(n,"$1__d"))),l=(r?l.replace(at,""):l).replace(ft,"$1").replace(lt,"$1;"),l="function("+c+"){"+(h?"":c+"||("+c+"={});")+"var __t,__p='',__e=_.escape"+(r?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":(h?"":",__d="+ +c+"."+c+"||"+c)+";")+l+"return __p}";try{i=o("_","return "+l)(s)}catch(d){throw d.source=l,d}return t?i(t):(i.source=l,i)},s.throttle=function(e,t){function n(){a=new Date,u=r,s=e.apply(o,i)}var i,s,o,u,a=0;return function(){var f=new Date,l=t-(f-a);return i=arguments,o=this,0>=l?(clearTimeout(u),u=r,a=f,s=e.apply(o,i)):u||(u=setTimeout(n,l)),s}},s.unescape=function(e){return e==r?"":(e+"").replace(ut,y)},s.uniqueId=function(e){return(e==r?"":e+"")+ ++nt},s.wrap=function(e,t){return function(){var n= +[e];return Nt.apply(n,arguments),t.apply(this,n)}},s.all=D,s.any=R,s.detect=H,s.foldl=I,s.foldr=q,s.include=_,s.inject=I,pn(s,function(e,t){s.prototype[t]||(s.prototype[t]=function(){var t=[this.__wrapped__];return Nt.apply(t,arguments),e.apply(s,t)})}),s.first=U,s.last=function(e,t,n){if(e){var i=e.length;return t==r||n?e[i-1]:g(e,Dt(0,i-t))}},s.take=U,s.head=U,pn(s,function(e,t){s.prototype[t]||(s.prototype[t]=function(t,n){var i=e(this.__wrapped__,t,n);return t==r||n?i:new s(i)})}),s.VERSION="1.0.0-rc.2" +,s.prototype.chain=function(){return this},s.prototype.toString=function(){return""+this.__wrapped__},s.prototype.value=G,s.prototype.valueOf=G,wn("pop push reverse shift sort splice unshift".split(" "),function(e){var t=et[e];s.prototype[e]=function(){var e=this.__wrapped__;return t.apply(e,arguments),Gt&&e.length===0&&delete e[0],this}}),wn(["concat","join","slice"],function(e){var t=et[e];s.prototype[e]=function(){var e=t.apply(this.__wrapped__,arguments);return new s(e)}}),typeof define=="function"&&typeof +define.amd=="object"&&define.amd?(e._=s,define(function(){return s})):Y?"object"==typeof module&&module&&module.exports==Y?(module.exports=s)._=s:Y._=s:e._=s})(this); \ No newline at end of file diff --git a/lodash.underscore.js b/lodash.underscore.js index 64759cb5f8..7760563d10 100644 --- a/lodash.underscore.js +++ b/lodash.underscore.js @@ -1,8 +1,8 @@ /*! - * Lo-Dash 1.0.0-rc.1 (Custom Build) + * Lo-Dash 1.0.0-rc.2 (Custom Build) * Build: `lodash underscore -d -o ./lodash.underscore.js` * (c) 2012 John-David Dalton - * Based on Underscore.js 1.4.2 + * Based on Underscore.js 1.4.3 * (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. * Available under MIT license */ @@ -133,7 +133,6 @@ var hasObjectSpliceBug = (hasObjectSpliceBug = { '0': 1, 'length': 1 }, arrayRef.splice.call(hasObjectSpliceBug, 0, 1), hasObjectSpliceBug[0]); - /** * Detect lack of support for accessing string characters by index: * @@ -615,7 +614,6 @@ for (index in iteratee) { if (callback(iteratee[index], index, collection) === indicatorObject) return result; } - ; return result }; @@ -649,7 +647,6 @@ if (callback(iteratee[index], index, collection) === indicatorObject) return result; } } - ; return result }; @@ -765,6 +762,7 @@ ? (isArray(value) ? slice(value) : assign({}, value)) : value } + /** * Assigns own enumerable properties of source object(s) to the `destination` * object for all `destination` properties that resolve to `null`/`undefined`. @@ -799,6 +797,7 @@ } return object; } + /** * Creates a sorted array of all enumerable properties, own and inherited, * of `object` that have function values. @@ -970,6 +969,7 @@ } return true; } + /** * Performs a deep comparison between two values to determine if they are * equivalent to each other. @@ -1140,8 +1140,9 @@ * // => false */ function isFinite(value) { - return nativeIsFinite(value) && toString.call(value) == numberClass; + return nativeIsFinite(value) && !nativeIsNaN(parseFloat(value)); } + /** * Checks if `value` is a function. * @@ -1365,6 +1366,7 @@ }); return result; } + /** * Creates a two dimensional array of the given object's key-value pairs, * i.e. `[[key1, value1], [key2, value2]]`. @@ -1426,6 +1428,7 @@ } return result; } + /** * Creates an array composed of the own enumerable property values of `object`. * @@ -1488,6 +1491,7 @@ } return result; } + /** * Creates an object composed of keys returned from running each element of * `collection` through a `callback`. The corresponding value of each key is @@ -1677,7 +1681,6 @@ } } } - ; }; @@ -2252,6 +2255,7 @@ } return result } + /** * Gets the first element of the `array`. Pass `n` to return the first `n` * elements of the `array`. @@ -2417,6 +2421,7 @@ }); return result; } + /** * Gets the last element of the `array`. Pass `n` to return the last `n` * elements of the `array`. @@ -2691,6 +2696,11 @@ result = [], seen = result; + if (typeof isSorted == 'function') { + thisArg = callback; + callback = isSorted; + isSorted = false; + } if (callback) { seen = []; callback = createCallback(callback, thisArg); @@ -2711,6 +2721,7 @@ } return result; } + /** * Creates an array with all occurrences of the passed values removed using * strict equality for comparisons, i.e. `===`. @@ -2739,6 +2750,7 @@ } return result } + /** * Groups the elements of each array at their corresponding indexes. Useful for * separate data sources that are coordinated through matching array indexes. @@ -3411,6 +3423,7 @@ result.source = source; return result; } + /** * Executes the `callback` function `n` times, returning an array of the results * of each `callback` execution. The `callback` is bound to `thisArg` and invoked @@ -3481,9 +3494,10 @@ * // => '105' */ function uniqueId(prefix) { - var id = idCounter++; + var id = ++idCounter + ''; return prefix ? prefix + id : id; } + /*--------------------------------------------------------------------------*/ /** @@ -3513,6 +3527,7 @@ value.__chain__ = true; return value; } + /** * Invokes `interceptor` with the `value` as the first argument, and then * returns `value`. The purpose of this method is to "tap into" a method chain, @@ -3561,6 +3576,7 @@ this.__chain__ = true; return this; } + /** * Produces the `toString` result of the wrapped value. * @@ -3596,44 +3612,72 @@ /*--------------------------------------------------------------------------*/ - /** - * The semantic version number. - * - * @static - * @memberOf _ - * @type String - */ - lodash.VERSION = '1.0.0-rc.1'; - lodash.after = after; - lodash.bind = bind; lodash.bindAll = bindAll; lodash.chain = chain; - lodash.clone = clone; lodash.compact = compact; - lodash.compose = compose; - lodash.contains = contains; lodash.countBy = countBy; - lodash.debounce = debounce; lodash.defaults = defaults; - lodash.defer = defer; - lodash.delay = delay; lodash.difference = difference; - lodash.escape = escape; - lodash.every = every; lodash.filter = filter; - lodash.find = find; - lodash.first = first; lodash.flatten = flatten; lodash.forEach = forEach; lodash.functions = functions; lodash.groupBy = groupBy; - lodash.has = has; - lodash.identity = identity; - lodash.indexOf = indexOf; lodash.initial = initial; lodash.intersection = intersection; lodash.invert = invert; lodash.invoke = invoke; + lodash.keys = keys; + lodash.map = map; + lodash.max = max; + lodash.min = min; + lodash.object = object; + lodash.omit = omit; + lodash.pairs = pairs; + lodash.pick = pick; + lodash.pluck = pluck; + lodash.range = range; + lodash.reject = reject; + lodash.rest = rest; + lodash.shuffle = shuffle; + lodash.sortBy = sortBy; + lodash.tap = tap; + lodash.times = times; + lodash.toArray = toArray; + lodash.union = union; + lodash.uniq = uniq; + lodash.values = values; + lodash.where = where; + lodash.without = without; + lodash.zip = zip; + + // add aliases + lodash.collect = map; + lodash.drop = rest; + lodash.each = forEach; + lodash.extend = assign; + lodash.methods = functions; + lodash.select = filter; + lodash.tail = rest; + lodash.unique = uniq; + + /*--------------------------------------------------------------------------*/ + + // add functions that return unwrapped values when chaining + lodash.after = after; + lodash.bind = bind; + lodash.clone = clone; + lodash.compose = compose; + lodash.contains = contains; + lodash.debounce = debounce; + lodash.defer = defer; + lodash.delay = delay; + lodash.escape = escape; + lodash.every = every; + lodash.find = find; + lodash.has = has; + lodash.identity = identity; + lodash.indexOf = indexOf; lodash.isArray = isArray; lodash.isBoolean = isBoolean; lodash.isDate = isDate; @@ -3649,87 +3693,70 @@ lodash.isRegExp = isRegExp; lodash.isString = isString; lodash.isUndefined = isUndefined; - lodash.keys = keys; - lodash.last = last; lodash.lastIndexOf = lastIndexOf; - lodash.map = map; - lodash.max = max; lodash.memoize = memoize; - lodash.min = min; lodash.mixin = mixin; lodash.noConflict = noConflict; - lodash.object = object; - lodash.omit = omit; lodash.once = once; - lodash.pairs = pairs; - lodash.pick = pick; - lodash.pluck = pluck; lodash.random = random; - lodash.range = range; lodash.reduce = reduce; lodash.reduceRight = reduceRight; - lodash.reject = reject; - lodash.rest = rest; lodash.result = result; - lodash.shuffle = shuffle; lodash.size = size; lodash.some = some; - lodash.sortBy = sortBy; lodash.sortedIndex = sortedIndex; - lodash.tap = tap; lodash.template = template; lodash.throttle = throttle; - lodash.times = times; - lodash.toArray = toArray; lodash.unescape = unescape; - lodash.union = union; - lodash.uniq = uniq; lodash.uniqueId = uniqueId; - lodash.values = values; - lodash.where = where; - lodash.without = without; lodash.wrap = wrap; - lodash.zip = zip; - // assign aliases + // add aliases lodash.all = every; lodash.any = some; - lodash.collect = map; lodash.detect = find; - lodash.drop = rest; - lodash.each = forEach; - lodash.extend = assign; lodash.foldl = reduce; lodash.foldr = reduceRight; - lodash.head = first; lodash.include = contains; lodash.inject = reduce; - lodash.methods = functions; - lodash.select = filter; - lodash.tail = rest; + + /*--------------------------------------------------------------------------*/ + + // add functions capable of returning wrapped and unwrapped values when chaining + lodash.first = first; + lodash.last = last; + + // add aliases lodash.take = first; - lodash.unique = uniq; + lodash.head = first; /*--------------------------------------------------------------------------*/ - // add all static functions to `lodash.prototype` + /** + * The semantic version number. + * + * @static + * @memberOf _ + * @type String + */ + lodash.VERSION = '1.0.0-rc.2'; + + // add functions to `lodash.prototype` mixin(lodash); - // add `lodash.prototype.chain` after calling `mixin()` to avoid overwriting - // it with the wrapped `lodash.chain` + // add "Chaining" functions to the wrapper lodash.prototype.chain = wrapperChain; lodash.prototype.value = wrapperValueOf; - // add all mutator Array functions to the wrapper. + // add mutator `Array` functions to the wrapper forEach(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(methodName) { var func = arrayRef[methodName]; - lodash.prototype[methodName] = function() { var value = this.__wrapped__; func.apply(value, arguments); - // avoid array-like object bugs with `Array#shift` and `Array#splice` in - // Firefox < 10 and IE < 9 + // avoid array-like object bugs with `Array#shift` and `Array#splice` + // in Firefox < 10 and IE < 9 if (hasObjectSpliceBug && value.length === 0) { delete value[0]; } @@ -3737,10 +3764,9 @@ }; }); - // add all accessor Array functions to the wrapper. + // add accessor `Array` functions to the wrapper forEach(['concat', 'join', 'slice'], function(methodName) { var func = arrayRef[methodName]; - lodash.prototype[methodName] = function() { var value = this.__wrapped__, result = func.apply(value, arguments); diff --git a/lodash.underscore.min.js b/lodash.underscore.min.js index b0bf235ebb..afeffa6a05 100644 --- a/lodash.underscore.min.js +++ b/lodash.underscore.min.js @@ -1,33 +1,33 @@ /*! - Lo-Dash 1.0.0-rc.1 (Custom Build) lodash.com/license + Lo-Dash 1.0.0-rc.2 (Custom Build) lodash.com/license Build: `lodash underscore -m -o ./lodash.underscore.min.js` - Underscore.js 1.4.2 underscorejs.org/LICENSE + Underscore.js 1.4.3 underscorejs.org/LICENSE */ ;(function(e,t){function n(e){if(e&&"object"==typeof e&&e.__wrapped__)return e;if(!(this instanceof n))return new n(e);this.__wrapped__=e}function r(e,t){var n=e.b,r=t.b,e=e.a,t=t.a;if(e!==t){if(e>t||"undefined"==typeof e)return 1;if(en?0:n);++rr&&(r=n,u=e)});else for(;++iu&&(u=e[i]);return u}function L(e,t){return C(e,t+"")}function A(e,t,n,r){var i=3>arguments.length;return t||(t=I),Lt(e,function(e,s,o){n=i?(i=!1,e):t.call(r,n,e,s,o)}),n}function O(e,t,n,r){var i=e?e.length:0,s=3>arguments.length;if("number"!=typeof i)var o=kt(e),i=o.length;return t||(t=I -),Lt(e,function(u,a,f){a=o?o[--i]:--i,n=s?(s=!1,e[a]):t.call(r,n,e[a],a,f)}),n}function M(e,t,n){var r,t=s(t,n);if(Ct(e))for(var n=-1,i=e.length;++nn?at -(0,i+n):n||0)-1;else if(n)return r=B(e,t),e[r]===t?r:-1;for(;++r>>1,n(e[r])P(a,f))n&&a.push(f),u.push(r)}return u}function F(e,t){return yt||it&&2"']/g,G=/['\n\r\t\u2028\u2029\\]/g,Y=Math.ceil,Z=z.concat,et=Math.floor,tt=U.hasOwnProperty,nt=z.push,rt=U.toString,it=J.test(it=f.bind)&&it,st=J.test(st=Array.isArray)&&st,ot=e.isFinite,ut=J.test(ut=Object.keys)&&ut,at=Math.max,ft=Math.min,lt=Math.random,ct="[object Array]",ht="[object Boolean]",pt="[object Date]",dt="[object Number]",vt="[object Object]",mt="[object RegExp]",gt="[object String]",U=!!e.attachEvent,U=it&&!/\n|true/.test(it+U),yt=it&&!U,bt=(bt={0:1,length -:1},z.splice.call(bt,0,1),bt[0]),wt={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,"undefined":!1},Et={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"};n.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},n.isArguments=function(e){return"[object Arguments]"==rt.call(e)},n.isArguments(arguments)||(n.isArguments=function(e){return e?tt.call(e,"callee"):!1});var St=function(e,t){var n;if(!e)return e -;t||(t=I);for(n in e)if(t(e[n],n,e)===X)break;return e},xt=function(e,t){var n;if(!e)return e;t||(t=I);for(n in e)if(tt.call(e,n)&&t(e[n],n,e)===X)break;return e},Tt={"&":"&","<":"<",">":">",'"':""","'":"'"},Nt=v(Tt),Ct=st||function(e){return rt.call(e)==ct};g(/x/)&&(g=function(e){return"[object Function]"==rt.call(e)});var kt=ut?function(e){return y(e)?ut(e):[]}:h,Lt=function(e,t,n){if(!e)return e;var t=t&&"undefined"==typeof n?t:s(t,n),r=e.length,n=-1;if("number"==typeof r){ -for(;++ne?t():function(){if(1>--e)return t.apply(this,arguments)}},n.bind=F,n.bindAll=function(e){for(var t=arguments,n=1P(r,s,n)&&i.push(s)}return i},n.escape=function(e){return null==e?"":(e+"").replace(Q,u)},n.every=x,n.filter=T,n.find=N,n.first=_,n.flatten=D,n.forEach=Lt,n.functions=d,n.groupBy=function(e,t,n){var r={ -},t=s(t,n);return Lt(e,function(e,n,i){n=t(e,n,i),(tt.call(r,n)?r[n]:r[n]=[]).push(e)}),r},n.has=function(e,t){return e?tt.call(e,t):!1},n.identity=I,n.indexOf=P,n.initial=function(e,t,n){if(!e)return[];var r=e.length;return f(e,0,ft(at(0,r-(null==t||n?1:t||0)),r))},n.intersection=function(e){var t=arguments,n=t.length,r=[];return Lt(e,function(e){if(0>P(r,e)){for(var i=n;--i;)if(0>P(t[i],e))return;r.push(e)}}),r},n.invert=v,n.invoke=function(e,t){var n=f(arguments,2),r="function"==typeof t,i=[]; -return Lt(e,function(e){i.push((r?t:e[t]).apply(e,n))}),i},n.isArray=Ct,n.isBoolean=function(e){return!0===e||!1===e||rt.call(e)==ht},n.isDate=function(e){return rt.call(e)==pt},n.isElement=function(e){return e?1===e.nodeType:!1},n.isEmpty=function(e){if(!e)return!0;if(Ct(e)||w(e))return!e.length;for(var t in e)if(tt.call(e,t))return!1;return!0},n.isEqual=m,n.isFinite=function(e){return ot(e)&&rt.call(e)==dt},n.isFunction=g,n.isNaN=function(e){return b(e)&&e!=+e},n.isNull=function(e){return null=== -e},n.isNumber=b,n.isObject=y,n.isRegExp=function(e){return rt.call(e)==mt},n.isString=w,n.isUndefined=function(e){return"undefined"==typeof e},n.keys=kt,n.last=function(e,t,n){if(e){var r=e.length;return null==t||n?e[r-1]:f(e,at(0,r-t))}},n.lastIndexOf=function(e,t,n){var r=e?e.length:0;for("number"==typeof n&&(r=(0>n?at(0,r+n):ft(n,r-1))+1);r--;)if(e[r]===t)return r;return-1},n.map=C,n.max=k,n.memoize=function(e,t){var n={};return function(){var r=t?t.apply(this,arguments):arguments[0];return tt -.call(n,r)?n[r]:n[r]=e.apply(this,arguments)}},n.min=function(e,t,n){var r=Infinity,i=-1,o=e?e.length:0,u=r;if(t||!Ct(e))t=s(t,n),Lt(e,function(e,n,i){n=t(e,n,i),nP(t,r,1)&&(n[r]=e)}),n},n.once=function( -e){var t,n=!1;return function(){return n?t:(n=!0,t=e.apply(this,arguments),e=null,t)}},n.pairs=function(e){var t=[];return xt(e,function(e,n){t.push([n,e])}),t},n.pick=function(e){for(var t=0,n=Z.apply(z,arguments),r=n.length,i={};++t=f?(clearTimeout(o),o=null,u=a,i=e.apply(s,r)):o||(o=setTimeout(n,f)),i}},n.times=function(e,t,n){for(var e=+ -e||0,r=-1,i=Array(e);++rP(arguments,i,1)&&r.push(i)}return r},n.wrap=function(e,t){return function(){var n=[e];return nt.apply(n,arguments),t.apply(this,n)}},n.zip=function(e){for(var t=-1,n=e?k(L(arguments,"length")):0,r=Array(n);++tn?0:n);++rr&&(r=n,u=e)});else for(;++iu&&(u=e[i]);return u}function L(e,t){return C(e,t+"")}function A(e,t,n,r){var i=3>arguments.length;return t||(t=I),At(e,function(e,s,o){n=i?(i=!1,e):t.call(r,n,e,s,o)}),n}function O(e,t,n,r){var i=e?e.length:0,s=3>arguments.length;if("number"!=typeof i)var o=Lt(e),i=o.length;return t||(t=I +),At(e,function(u,a,f){a=o?o[--i]:--i,n=s?(s=!1,e[a]):t.call(r,n,e[a],a,f)}),n}function M(e,t,n){var r,t=s(t,n);if(kt(e))for(var n=-1,i=e.length;++nn?ft +(0,i+n):n||0)-1;else if(n)return r=B(e,t),e[r]===t?r:-1;for(;++r>>1,n(e[r])P(a,f))n&&a.push(f),u.push(r)}return u}function F(e,t){return bt|| +it&&2"']/g,G=/['\n\r\t\u2028\u2029\\]/g,Y=Math.ceil,Z=z.concat,et=Math.floor,tt=U.hasOwnProperty,nt=z.push,rt=U.toString,it=J.test(it=f.bind)&&it,st=J.test(st=Array.isArray)&&st,ot=e.isFinite,ut=e.isNaN,at=J.test(at=Object.keys)&&at,ft=Math.max,lt=Math.min,ct=Math.random,ht="[object Array]",pt="[object Boolean]",dt="[object Date]",vt="[object Number]",mt="[object Object]",gt="[object RegExp]",yt="[object String]",U=!!e.attachEvent,U=it&&!/\n|true/ +.test(it+U),bt=it&&!U,wt=(wt={0:1,length:1},z.splice.call(wt,0,1),wt[0]),Et={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,"undefined":!1},St={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"};n.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},n.isArguments=function(e){return"[object Arguments]"==rt.call(e)},n.isArguments(arguments)||(n.isArguments=function(e){return e?tt.call(e,"callee"):!1} +);var xt=function(e,t){var n;if(!e)return e;t||(t=I);for(n in e)if(t(e[n],n,e)===X)break;return e},Tt=function(e,t){var n;if(!e)return e;t||(t=I);for(n in e)if(tt.call(e,n)&&t(e[n],n,e)===X)break;return e},Nt={"&":"&","<":"<",">":">",'"':""","'":"'"},Ct=v(Nt),kt=st||function(e){return rt.call(e)==ht};g(/x/)&&(g=function(e){return"[object Function]"==rt.call(e)});var Lt=at?function(e){return y(e)?at(e):[]}:h,At=function(e,t,n){if(!e)return e;var t=t&&"undefined"==typeof n?t:s(t +,n),r=e.length,n=-1;if("number"==typeof r){for(;++nP(r,s,n)&&i.push(s)}return i},n.filter=T,n.flatten=D,n.forEach=At,n.functions=d,n.groupBy=function(e,t,n){var r={},t=s(t,n);return At(e,function(e,n,i){n=t(e,n,i),(tt.call(r,n)?r[n]:r[n]=[]).push(e)}),r},n.initial=function(e,t,n){if(!e)return[];var r=e.length;return f(e,0,lt(ft(0,r-(null==t||n?1:t||0)),r))},n.intersection=function(e){var t=arguments,n=t.length +,r=[];return At(e,function(e){if(0>P(r,e)){for(var i=n;--i;)if(0>P(t[i],e))return;r.push(e)}}),r},n.invert=v,n.invoke=function(e,t){var n=f(arguments,2),r="function"==typeof t,i=[];return At(e,function(e){i.push((r?t:e[t]).apply(e,n))}),i},n.keys=Lt,n.map=C,n.max=k,n.min=function(e,t,n){var r=Infinity,i=-1,o=e?e.length:0,u=r;if(t||!kt(e))t=s(t,n),At(e,function(e,n,i){n=t(e,n,i),nP(t,r,1)&&(n[r]=e)}),n},n.pairs=function(e){var t=[];return Tt(e,function(e,n){t.push([n,e])}),t},n.pick=function(e){for(var t=0,n=Z.apply(z,arguments),r=n.length,i={};++tP(arguments,i,1)&&r.push(i)}return r},n.zip=function(e){for(var t=-1,n=e?k(L(arguments,"length")):0,r=Array(n);++te?t():function(){if(1>--e)return t.apply(this,arguments)}},n.bind=F,n.clone=function(e){return e&&Et[typeof e]?kt(e)?f(e):c({},e):e},n.compose=function(){var e=arguments;return function(){for(var t=arguments,n=e.length;n--;)t=[e[n].apply(this,t)];return t[0]}},n.contains=S,n.debounce=function(e,t,n){function r(){u=null,n||(s=e.apply(o,i))}var i,s,o,u;return function(){var a=n&&!u;return i=arguments,o=this,clearTimeout(u),u=setTimeout( +r,t),a&&(s=e.apply(o,i)),s}},n.defer=function(e){var n=f(arguments,1);return setTimeout(function(){e.apply(t,n)},1)},n.delay=function(e,n){var r=f(arguments,2);return setTimeout(function(){e.apply(t,r)},n)},n.escape=function(e){return null==e?"":(e+"").replace(Q,u)},n.every=x,n.find=N,n.has=function(e,t){return e?tt.call(e,t):!1},n.identity=I,n.indexOf=P,n.isArray=kt,n.isBoolean=function(e){return!0===e||!1===e||rt.call(e)==pt},n.isDate=function(e){return rt.call(e)==dt},n.isElement=function(e){return e?1=== +e.nodeType:!1},n.isEmpty=function(e){if(!e)return!0;if(kt(e)||w(e))return!e.length;for(var t in e)if(tt.call(e,t))return!1;return!0},n.isEqual=m,n.isFinite=function(e){return ot(e)&&!ut(parseFloat(e))},n.isFunction=g,n.isNaN=function(e){return b(e)&&e!=+e},n.isNull=function(e){return null===e},n.isNumber=b,n.isObject=y,n.isRegExp=function(e){return rt.call(e)==gt},n.isString=w,n.isUndefined=function(e){return"undefined"==typeof e},n.lastIndexOf=function(e,t,n){var r=e?e.length:0;for("number"==typeof +n&&(r=(0>n?ft(0,r+n):lt(n,r-1))+1);r--;)if(e[r]===t)return r;return-1},n.memoize=function(e,t){var n={};return function(){var r=t?t.apply(this,arguments):arguments[0];return tt.call(n,r)?n[r]:n[r]=e.apply(this,arguments)}},n.mixin=q,n.noConflict=function(){return e._=V,this},n.once=function(e){var t,n=!1;return function(){return n?t:(n=!0,t=e.apply(this,arguments),e=null,t)}},n.random=function(e,t){return null==e&&null==t&&(t=1),e=+e||0,null==t&&(t=e,e=0),e+et(ct()*((+t||0)-e+1))},n.reduce=A,n.reduceRight= +O,n.result=function(e,t){var n=e?e[t]:null;return g(n)?e[t]():n},n.size=function(e){var t=e?e.length:0;return"number"==typeof t?t:Lt(e).length},n.some=M,n.sortedIndex=B,n.template=function(e,t,r){e||(e="");var r=p({},r,n.templateSettings),i=0,s="__p+='",u=r.variable;e.replace(RegExp((r.escape||K).source+"|"+(r.interpolate||K).source+"|"+(r.evaluate||K).source+"|$","g"),function(t,n,r,u,a){s+=e.slice(i,a).replace(G,o),s+=n?"'+_['escape']("+n+")+'":u?"';"+u+";__p+='":r?"'+((__t=("+r+"))==null?'':__t)+'" +:"",i=a+t.length}),s+="';\n",u||(u="obj",s="with("+u+"||{}){"+s+"}"),s="function("+u+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+s+"return __p}";try{var a=Function("_","return "+s)(n)}catch(f){throw f.source=s,f}return t?a(t):(a.source=s,a)},n.throttle=function(e,t){function n(){u=new Date,o=null,i=e.apply(s,r)}var r,i,s,o,u=0;return function(){var a=new Date,f=t-(a-u);return r=arguments,s=this,0>=f?(clearTimeout(o),o=null,u=a,i=e.apply(s,r)):o||(o=setTimeout +(n,f)),i}},n.unescape=function(e){return null==e?"":(e+"").replace($,l)},n.uniqueId=function(e){var t=++W+"";return e?e+t:t},n.wrap=function(e,t){return function(){var n=[e];return nt.apply(n,arguments),t.apply(this,n)}},n.all=x,n.any=M,n.detect=N,n.foldl=A,n.foldr=O,n.include=S,n.inject=A,n.first=_,n.last=function(e,t,n){if(e){var r=e.length;return null==t||n?e[r-1]:f(e,ft(0,r-t))}},n.take=_,n.head=_,n.VERSION="1.0.0-rc.2",q(n),n.prototype.chain=function(){return this.__chain__=!0,this},n.prototype +.value=function(){return this.__wrapped__},At("pop push reverse shift sort splice unshift".split(" "),function(e){var t=z[e];n.prototype[e]=function(){var e=this.__wrapped__;return t.apply(e,arguments),wt&&e.length===0&&delete e[0],this}}),At(["concat","join","slice"],function(e){var t=z[e];n.prototype[e]=function(){var e=t.apply(this.__wrapped__,arguments);return this.__chain__&&(e=new n(e),e.__chain__=!0),e}}),R?"object"==typeof module&&module&&module.exports==R?(module.exports=n)._=n:R._=n:e._= n})(this); \ No newline at end of file diff --git a/package.json b/package.json index df06c63c0f..b2a0a20832 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lodash", - "version": "1.0.0-rc.1", + "version": "1.0.0-rc.2", "description": "A utility library, usable as a drop-in replacement for Underscore, delivering performance, bug fixes, and additional features.", "homepage": "http://lodash.com", "main": "./lodash", diff --git a/test/test-build.js b/test/test-build.js index 01e2536a2d..18a475a38a 100644 --- a/test/test-build.js +++ b/test/test-build.js @@ -679,7 +679,6 @@ object = { 'length': 0, 'splice': Array.prototype.splice }; equal(lodash.isEmpty(object), false, '_.isEmpty should return `false` for jQuery/MooTools DOM query collections: ' + basename); - equal(lodash.isFinite('2'), false, '_.isFinite should return `false` for numeric string values: ' + basename); object = { 'a': 1, 'b': 2, 'c': 3 }; equal(lodash.isEqual(object, { 'a': 1, 'b': 0, 'c': 3 }), false, '_.isEqual: ' + basename); @@ -697,10 +696,7 @@ equal(lodash.some([false, true, false]), true, '_.some: ' + basename); equal(lodash.template('${a}', object), '${a}', '_.template should ignore ES6 delimiters: ' + basename); - - actual = [lodash.uniqueId(3), lodash.uniqueId(2), lodash.uniqueId(1)]; - equal(actual.join(','), '3,3,3', '_.uniqueId should not coerce the prefix argument to a string: ' + basename); - equal(typeof lodash.uniqueId(), 'number', '_.uniqueId should return a number value when not passing a prefix argument: ' + basename); + equal(lodash.uniqueId(0), '1', '_.uniqueId should ignore a prefix of `0`: ' + basename); var wrapped = lodash(1); equal(wrapped.clone() instanceof lodash, false, '_(...) wrapped values are not chainable by default: ' + basename); diff --git a/test/underscore.html b/test/underscore.html index 9d77550a04..9f2d1974a9 100644 --- a/test/underscore.html +++ b/test/underscore.html @@ -19,7 +19,6 @@ -