Compare commits

..

32 Commits
0.5.2 ... 0.6.1

Author SHA1 Message Date
John-David Dalton
141c10f6fe Ensure noArgsClass references aren't removed for "underscore" builds.
Former-commit-id: 697e2d29d5fef32b0b10d775eee7a12d193ff1a9
2012-08-30 00:58:54 -07:00
John-David Dalton
4613ab9dc3 Update cdn links and tested browsers in README.md.
Former-commit-id: db952c5d72fa9e4d6ce3280574b9e4e26da8c928
2012-08-29 18:03:03 -07:00
John-David Dalton
061ad41b51 Cleanup link hashes in generated docs and update vendors.
Former-commit-id: 278366a7dacea91d965835b24ae7ec046f455110
2012-08-29 08:28:37 -07:00
John-David Dalton
3a0007cd18 Remove pseudo private properties from debug builds.
Former-commit-id: 839c2e47e19ba163f0c69d3c115ec9ee262d5d6b
2012-08-29 01:17:28 -07:00
John-David Dalton
0044917943 Ensure Closure Compiler removes isPlainObject when it's no longer needed in build.js.
Former-commit-id: 748de0f28f4e0733ef83a77fe2b1f6e40e4f8ce2
2012-08-29 00:34:58 -07:00
John-David Dalton
0337c04278 Bump to v0.6.1.
Former-commit-id: 68b59ea3e76d06d60acc81e30770b5899b8ea761
2012-08-29 00:14:40 -07:00
John-David Dalton
4585acf70b Optimize isPlainObject.
Former-commit-id: 37754e27d03929927d8b8653bd7e44ad3ce2b23c
2012-08-29 00:05:02 -07:00
John-David Dalton
2ad9bbae25 Avoid issues in IE with other code containing comments like //@todo xyz.
Former-commit-id: 92ec6258539bf48144e9af05d0e326651a5fedda
2012-08-28 23:58:07 -07:00
John-David Dalton
cf075df7d1 Update cdnjs link in README.md.
Former-commit-id: 50a52807a505d0d559f9977e3b5c9532fa3f131e
2012-08-28 08:58:47 -07:00
John-David Dalton
11cd9905c4 Bump to v0.6.0.
Former-commit-id: 7339c27ba63208f23d94ae4a29dec53a43220bad
2012-08-28 01:47:22 -07:00
John-David Dalton
cf462542e9 Cleanup iteratorTemplate and remove more code from the "underscore" build.
Former-commit-id: 3f4c283f0aa205dbcce1940f7222b594284263c4
2012-08-28 00:30:52 -07:00
John-David Dalton
b63f25a1ae Simplify _.unescape to match the behavior of _.escape.
Former-commit-id: ec7f4cf9a6f44b1ba99f467c47d7e04d5596d76e
2012-08-27 07:54:03 -07:00
John-David Dalton
7de69a21c5 Cleanup unescape comments.
Former-commit-id: 4c0a66d28ed8b04748e4d97755983ec328e53ca4
2012-08-27 02:54:55 -07:00
John-David Dalton
21783e4ea0 Add unescape to the dependency map and exclude unescape from the "underscore" build.
Former-commit-id: 20656e5226207e55713a286c7d7069b73170272f
2012-08-27 02:33:38 -07:00
John-David Dalton
53e5a756d7 Update minified build, docdown, and rebuild docs.
Former-commit-id: f198b30ba8963d8b69838ba31d2e3d8085537629
2012-08-27 02:09:04 -07:00
John-David Dalton
8c911a2fd0 Add _.unescape method. [closes #63]
Former-commit-id: 10eada385fd0e1157271a2da6fb32de047d6d88a
2012-08-27 02:05:37 -07:00
John-David Dalton
ce440e9f43 Add hasObjectSpliceBug to avoid unnecessary use of the delete operator from the mutator Array function mixin.
Former-commit-id: 8e92914f451454323a1ff6ef8ec1886b41e54ced
2012-08-26 12:54:03 -07:00
John-David Dalton
6465f8d8e6 Cleanup docs for _.drop, _.pick, _.countBy, _.groupBy, and _.sortBy.
Former-commit-id: 0dc89937d067c996fd28b585f42c1e01e928441b
2012-08-26 11:41:17 -07:00
John-David Dalton
4bdf28059a Cleanup unit tests, update minified build, and docs.
Former-commit-id: 5bca51894bf2fb01732a1ecc5873711d8abf3f9c
2012-08-26 03:09:19 -07:00
John-David Dalton
21010c6540 Add callback and thisArg arguments to _.drop and _.pick. [closes #62]
Former-commit-id: 990655e9e849348c287b3d994d2e2dc741f78fbf
2012-08-26 03:06:43 -07:00
John-David Dalton
a5a6cabac6 Cleanup createIterator and _.contains.
Former-commit-id: 39d4c33e5af0d9338a1725b5c07332a14f453374
2012-08-26 01:07:36 -07:00
John-David Dalton
f460c77f2c Ensure _.reduce works with string Objects in IE < 9.
Former-commit-id: 0ee3496e52f4c393900f37f03e451b8e4abba206
2012-08-26 01:04:09 -07:00
John-David Dalton
1c69d9213e Update minified build and rebuild docs.
Former-commit-id: e9da1d37b6741caf19c47e8dd81b89df60e8410f
2012-08-25 21:50:52 -07:00
John-David Dalton
c02c2d3b2c Optimize _.intersection, move largeSize default to largeArraySize, and cleanup _.where.
Former-commit-id: 9eaea7922623f1bd69f2b18578468a6fc9ba13fc
2012-08-25 21:50:08 -07:00
John-David Dalton
7adf5e763b Cleanup benchmarks in perf.js.
Former-commit-id: f845855383e01c63d513cea53cec86abb4f4fb65
2012-08-25 20:13:24 -07:00
John-David Dalton
0e4afefc7f Add more _.omit benchmarks and update Underscore.
Former-commit-id: b8de29706b381ebc000a7cbaa19aa0a2a628d6a8
2012-08-25 01:04:33 -07:00
John-David Dalton
c7f290f42e Cleanup unit tests and update ticket reference in README.md.
Former-commit-id: c2433e841c20eb17334d375deabcf0605ed49a3b
2012-08-25 01:00:19 -07:00
John-David Dalton
bb553b8a6a Update whitespace removal for delete operators in pre-compile.js.
Former-commit-id: 8dddeed54f8f13268f777d829ba52363706b9f4a
2012-08-25 00:56:00 -07:00
John-David Dalton
21eda2a1a3 Add _.omit as an alias of _.drop.
Former-commit-id: 630b0897bb49161fbc3b51a38c816b4bce548fba
2012-08-24 09:46:44 -07:00
John-David Dalton
48c13c990f Update vendors.
Former-commit-id: f2a09b6501a34b2ae2d8e996b13c9da4fb048535
2012-08-24 08:26:34 -07:00
John-David Dalton
a2665529f6 Optimize method compilation with/without strict mode.
Former-commit-id: 05e4d9282116987b53a817b406c82c140a25c761
2012-08-23 01:49:44 -07:00
John-David Dalton
8d35d78eff Ensure debug builds work against more build options.
Former-commit-id: 121b3605026d8f936e2ca0e3a03142cb08e75e66
2012-08-22 09:13:50 -07:00
18 changed files with 881 additions and 539 deletions

113
README.md
View File

@@ -1,4 +1,4 @@
# Lo-Dash <sup>v0.5.2</sup> # Lo-Dash <sup>v0.6.1</sup>
A drop-in replacement<sup>[*](https://github.com/bestiejs/lodash/wiki/Drop-in-Disclaimer)</sup> for Underscore.js, from the devs behind [jsPerf.com](http://jsperf.com), delivering [performance](http://lodash.com/benchmarks), [bug fixes](https://github.com/bestiejs/lodash#resolved-underscorejs-issues-30), and [additional features](https://github.com/bestiejs/lodash#features). A drop-in replacement<sup>[*](https://github.com/bestiejs/lodash/wiki/Drop-in-Disclaimer)</sup> for Underscore.js, from the devs behind [jsPerf.com](http://jsperf.com), delivering [performance](http://lodash.com/benchmarks), [bug fixes](https://github.com/bestiejs/lodash#resolved-underscorejs-issues-30), and [additional features](https://github.com/bestiejs/lodash#features).
@@ -6,9 +6,9 @@ Lo-Dashs performance is gained by avoiding slower native methods, instead opt
## Download ## Download
* [Development source](https://raw.github.com/bestiejs/lodash/v0.5.2/lodash.js) * [Development source](https://raw.github.com/bestiejs/lodash/v0.6.1/lodash.js)
* [Production source](https://raw.github.com/bestiejs/lodash/v0.5.2/lodash.min.js) * [Production source](https://raw.github.com/bestiejs/lodash/v0.6.1/lodash.min.js)
* CDN copies of ≤ [v0.5.2](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/0.5.2/lodash.min.js) are available on [cdnjs](http://cdnjs.com/) thanks to [CloudFlare](http://www.cloudflare.com/) * CDN copies of ≤ [v0.6.1](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/0.6.1/lodash.min.js) are available on [cdnjs](http://cdnjs.com/) thanks to [CloudFlare](http://www.cloudflare.com/)
* For optimal performance, [create a custom build](https://github.com/bestiejs/lodash#custom-builds) with only the features you need * For optimal performance, [create a custom build](https://github.com/bestiejs/lodash#custom-builds) with only the features you need
## Dive in ## Dive in
@@ -33,7 +33,7 @@ For more information check out these screencasts over Lo-Dash:
* AMD loader support ([RequireJS](http://requirejs.org/), [curl.js](https://github.com/cujojs/curl), etc.) * AMD loader support ([RequireJS](http://requirejs.org/), [curl.js](https://github.com/cujojs/curl), etc.)
* [_.bind](http://lodash.com/docs#bind) supports *“lazy”* binding * [_.bind](http://lodash.com/docs#bind) supports *“lazy”* binding
* [_.clone](http://lodash.com/docs#clone) supports *“deep”* cloning * [_.clone](http://lodash.com/docs#clone) supports *“deep”* cloning
* [_.countBy](http://lodash.com/docs#countBy) as a compainion function for [_.groupBy](http://lodash.com/docs#groupBy) and [_.sortBy](http://lodash.com/docs#sortBy) * [_.countBy](http://lodash.com/docs#countBy) as a companion function for [_.groupBy](http://lodash.com/docs#groupBy) and [_.sortBy](http://lodash.com/docs#sortBy)
* [_.debounce](http://lodash.com/docs#debounce)ed functions match [_.throttle](http://lodash.com/docs#throttle)ed functions return value behavior * [_.debounce](http://lodash.com/docs#debounce)ed functions match [_.throttle](http://lodash.com/docs#throttle)ed functions return value behavior
* [_.drop](http://lodash.com/docs#drop) for the inverse functionality of [_.pick](http://lodash.com/docs#pick) * [_.drop](http://lodash.com/docs#drop) for the inverse functionality of [_.pick](http://lodash.com/docs#pick)
* [_.forEach](http://lodash.com/docs#forEach) is chainable and supports exiting iteration early * [_.forEach](http://lodash.com/docs#forEach) is chainable and supports exiting iteration early
@@ -43,8 +43,10 @@ For more information check out these screencasts over Lo-Dash:
* [_.indexOf](http://lodash.com/docs#indexOf) and [_.lastIndexOf](http://lodash.com/docs#lastIndexOf) accept a `fromIndex` argument * [_.indexOf](http://lodash.com/docs#indexOf) and [_.lastIndexOf](http://lodash.com/docs#lastIndexOf) accept a `fromIndex` argument
* [_.merge](http://lodash.com/docs#merge) for a *“deep”* [_.extend](http://lodash.com/docs#extend) * [_.merge](http://lodash.com/docs#merge) for a *“deep”* [_.extend](http://lodash.com/docs#extend)
* [_.partial](http://lodash.com/docs#partial) for partial application without `this` binding * [_.partial](http://lodash.com/docs#partial) for partial application without `this` binding
* [_.pick](http://lodash.com/docs#pick) and [_.drop](http://lodash.com/docs#drop) accept `callback` and `thisArg` arguments
* [_.sortBy](http://lodash.com/docs#sortBy) performs a [stable](http://en.wikipedia.org/wiki/Sorting_algorithm#Stability) sort * [_.sortBy](http://lodash.com/docs#sortBy) performs a [stable](http://en.wikipedia.org/wiki/Sorting_algorithm#Stability) sort
* [_.template](http://lodash.com/docs#template) utilizes [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl) for easier debugging * [_.template](http://lodash.com/docs#template) utilizes [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl) for easier debugging
* [_.unescape](http://lodash.com/docs#unescape) to unescape strings escaped by [_.escape](http://lodash.com/docs#escape)
* [_.where](http://lodash.com/docs#where) for filtering collections by contained properties * [_.where](http://lodash.com/docs#where) for filtering collections by contained properties
* [_.zipObject](http://lodash.com/docs#zipObject) for composing objects * [_.zipObject](http://lodash.com/docs#zipObject) for composing objects
* [_.contains](http://lodash.com/docs#contains), [_.size](http://lodash.com/docs#size), [_.toArray](http://lodash.com/docs#toArray), * [_.contains](http://lodash.com/docs#contains), [_.size](http://lodash.com/docs#size), [_.toArray](http://lodash.com/docs#toArray),
@@ -52,7 +54,7 @@ For more information check out these screencasts over Lo-Dash:
## Support ## Support
Lo-Dash has been tested in at least Chrome 5-21, Firefox 1.5-13, IE 6-9, Opera 9.25-12.01, Safari 3-6, Node.js 0.4.8-0.8.7, Narwhal 0.3.2, RingoJS 0.8, and Rhino 1.7RC5. Lo-Dash has been tested in at least Chrome 5-21, Firefox 1-15, IE 6-9, Opera 9.25-12, Safari 3-6, Node.js 0.4.8-0.8.8, Narwhal 0.3.2, RingoJS 0.8, and Rhino 1.7RC5.
## Custom builds ## Custom builds
@@ -169,38 +171,38 @@ require({
## Resolved Underscore.js issues <sup>(30+)</sup> ## Resolved Underscore.js issues <sup>(30+)</sup>
* Allow iteration of objects with a `length` property [[#148](https://github.com/documentcloud/underscore/issues/148), [#154](https://github.com/documentcloud/underscore/issues/154), [#252](https://github.com/documentcloud/underscore/issues/252), [#448](https://github.com/documentcloud/underscore/issues/448), [#659](https://github.com/documentcloud/underscore/issues/659), [test](https://github.com/bestiejs/lodash/blob/v0.5.2/test/test.js#L551-557)] * Allow iteration of objects with a `length` property [[#148](https://github.com/documentcloud/underscore/issues/148), [#154](https://github.com/documentcloud/underscore/issues/154), [#252](https://github.com/documentcloud/underscore/issues/252), [#448](https://github.com/documentcloud/underscore/issues/448), [#659](https://github.com/documentcloud/underscore/issues/659), [test](https://github.com/bestiejs/lodash/blob/v0.6.1/test/test.js#L578-584)]
* Ensure array-like objects with invalid `length` properties are treated like regular objects [[test](https://github.com/bestiejs/lodash/blob/v0.5.2/test/test.js#L499-509)] * Ensure array-like objects with invalid `length` properties are treated like regular objects [[test](https://github.com/bestiejs/lodash/blob/v0.6.1/test/test.js#L526-536)]
* Ensure *“Arrays”*, “Collections”, and “Objects” methods dont error when passed falsey arguments [[#650](https://github.com/documentcloud/underscore/pull/650), [test](https://github.com/bestiejs/lodash/blob/v0.5.2/test/test.js#L1558-1593)] * Ensure *“Arrays”*, “Collections”, and “Objects” methods dont error when passed falsey arguments [[#650](https://github.com/documentcloud/underscore/pull/650), [test](https://github.com/bestiejs/lodash/blob/v0.6.1/test/test.js#L1668-1703)]
* Ensure *“Collections”* methods allow string `collection` arguments [[#247](https://github.com/documentcloud/underscore/issues/247), [#276](https://github.com/documentcloud/underscore/issues/276), [#561](https://github.com/documentcloud/underscore/pull/561), [test](https://github.com/bestiejs/lodash/blob/v0.5.2/test/test.js#L511-529)] * Ensure *“Collections”* methods allow string `collection` arguments [[#247](https://github.com/documentcloud/underscore/issues/247), [#276](https://github.com/documentcloud/underscore/issues/276), [#561](https://github.com/documentcloud/underscore/pull/561), [test](https://github.com/bestiejs/lodash/blob/v0.6.1/test/test.js#L538-555)]
* Ensure templates compiled with errors are inspectable [[#666](https://github.com/documentcloud/underscore/issues/666), [test](https://github.com/bestiejs/lodash/blob/v0.5.2/test/test.js#L1299-1302)] * Ensure templates compiled with errors are inspectable [[#666](https://github.com/documentcloud/underscore/issues/666), [test](https://github.com/bestiejs/lodash/blob/v0.6.1/test/test.js#L1383-1386)]
* 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/v0.5.2/test/test.js#L562-587)] * 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/v0.6.1/test/test.js#L589-614)]
* Handle arrays with `undefined` values correctly in IE < 9 [[#601](https://github.com/documentcloud/underscore/issues/601)] * Handle arrays with `undefined` values correctly in IE < 9 [[#601](https://github.com/documentcloud/underscore/issues/601)]
* Methods should work on pages with incorrectly shimmed native methods [[#7](https://github.com/documentcloud/underscore/issues/7), [test](https://github.com/bestiejs/lodash/blob/v0.5.2/test/test.js#L117-123)] * Methods should work on pages with incorrectly shimmed native methods [[#7](https://github.com/documentcloud/underscore/issues/7), [test](https://github.com/bestiejs/lodash/blob/v0.6.1/test/test.js#L117-123)]
* Register as an AMD module, but still export to global [[#431](https://github.com/documentcloud/underscore/pull/431), [test](https://github.com/bestiejs/lodash/blob/v0.5.2/test/test.js#L101-115)] * Register as an AMD module, but still export to global [[#431](https://github.com/documentcloud/underscore/pull/431), [test](https://github.com/bestiejs/lodash/blob/v0.6.1/test/test.js#L101-115)]
* `_(…)` should return passed wrapper instances [[test](https://github.com/bestiejs/lodash/blob/v0.5.2/test/test.js#L135-138)] * `_(…)` should return passed wrapper instances [[test](https://github.com/bestiejs/lodash/blob/v0.6.1/test/test.js#L135-138)]
* `_.clone` should allow `deep` cloning [[#595](https://github.com/documentcloud/underscore/pull/595), [test](https://github.com/bestiejs/lodash/blob/v0.5.2/test/test.js#L205-220)] * `_.clone` should allow `deep` cloning [[#595](https://github.com/documentcloud/underscore/pull/595), [test](https://github.com/bestiejs/lodash/blob/v0.6.1/test/test.js#L205-220)]
* `_.contains` should work with strings [[#667](https://github.com/documentcloud/underscore/pull/667), [test](https://github.com/bestiejs/lodash/blob/v0.5.2/test/test.js#L275-284)] * `_.contains` should work with strings [[#667](https://github.com/documentcloud/underscore/pull/667), [test](https://github.com/bestiejs/lodash/blob/v0.6.1/test/test.js#L275-284)]
* `_.escape` should return an empty string when passed `null` or `undefined` [[#427](https://github.com/documentcloud/underscore/issues/427), [test](https://github.com/bestiejs/lodash/blob/v0.5.2/test/test.js#L375-378)] * `_.countBy` and `_.groupBy` should only add values to own, not inherited, properties [[test](https://github.com/bestiejs/lodash/blob/v0.6.1/test/test.js#L292-299)]
* `_.extend` should recursively extend objects [[#379](https://github.com/documentcloud/underscore/pull/379), [test](https://github.com/bestiejs/lodash/blob/v0.5.2/test/test.js#L952-974)] * `_.escape` should return an empty string when passed `null` or `undefined` [[#427](https://github.com/documentcloud/underscore/issues/427), [test](https://github.com/bestiejs/lodash/blob/v0.6.1/test/test.js#L402-405)]
* `_.forEach` should be chainable [[#142](https://github.com/documentcloud/underscore/issues/142), [test](https://github.com/bestiejs/lodash/blob/v0.5.2/test/test.js#L494-497)] * `_.extend` should recursively extend objects [[#379](https://github.com/documentcloud/underscore/pull/379), [#718](https://github.com/documentcloud/underscore/issues/718), [test](https://github.com/bestiejs/lodash/blob/v0.6.1/test/test.js#L979-1001)]
* `_.forEach` should allow exiting iteration early [[#211](https://github.com/documentcloud/underscore/issues/211), [test](https://github.com/bestiejs/lodash/blob/v0.5.2/test/test.js#L589-608)] * `_.forEach` should be chainable [[#142](https://github.com/documentcloud/underscore/issues/142), [test](https://github.com/bestiejs/lodash/blob/v0.6.1/test/test.js#L521-524)]
* `_.groupBy` should add values to own, not inherited, properties [[test](https://github.com/bestiejs/lodash/blob/v0.5.2/test/test.js#L623-630)] * `_.forEach` should allow exiting iteration early [[#211](https://github.com/documentcloud/underscore/issues/211), [test](https://github.com/bestiejs/lodash/blob/v0.6.1/test/test.js#L616-635)]
* `_.isElement` should use strict equality for its duck type check [[test](https://github.com/bestiejs/lodash/blob/v0.5.2/test/test.js#L704-713)] * `_.isElement` should use strict equality for its duck type check [[test](https://github.com/bestiejs/lodash/blob/v0.6.1/test/test.js#L731-740)]
* `_.isEmpty` and `_.size` should support jQuery/MooTools DOM query collections [[#690](https://github.com/documentcloud/underscore/pull/690), [test](https://github.com/bestiejs/lodash/blob/v0.5.2/test/test.js#L740-745)] * `_.isEmpty` and `_.size` should support jQuery/MooTools DOM query collections [[#690](https://github.com/documentcloud/underscore/pull/690), [test](https://github.com/bestiejs/lodash/blob/v0.6.1/test/test.js#L767-772)]
* `_.isEqual` should return `true` for like-objects from different documents [[test](https://github.com/bestiejs/lodash/blob/v0.5.2/test/test.js#L781-801)] * `_.isEqual` should return `true` for like-objects from different documents [[test](https://github.com/bestiejs/lodash/blob/v0.6.1/test/test.js#L808-828)]
* `_.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/v0.5.2/test/test.js#L809-821)] * `_.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/v0.6.1/test/test.js#L836-848)]
* `_.isNaN(new Number(NaN))` should return `true` [[test](https://github.com/bestiejs/lodash/blob/v0.5.2/test/test.js#L829-831)] * `_.isNaN(new Number(NaN))` should return `true` [[test](https://github.com/bestiejs/lodash/blob/v0.6.1/test/test.js#L856-858)]
* `_.keys` and `_.size` should work with `arguments` objects cross-browser [[#396](https://github.com/documentcloud/underscore/issues/396), [#653](https://github.com/documentcloud/underscore/issues/653), [test](https://github.com/bestiejs/lodash/blob/v0.5.2/test/test.js#L885-887)] * `_.keys` and `_.size` should work with `arguments` objects cross-browser [[#396](https://github.com/documentcloud/underscore/issues/396), [#653](https://github.com/documentcloud/underscore/issues/653), [test](https://github.com/bestiejs/lodash/blob/v0.6.1/test/test.js#L912-914)]
* `_.once` should free the given function for garbage collection [[#693](https://github.com/documentcloud/underscore/pull/693)] * `_.once` should free the given function for garbage collection [[#693](https://github.com/documentcloud/underscore/pull/693)]
* `_.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/v0.5.2/test/test.js#L1110-1113)] * `_.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/v0.6.1/test/test.js#L1170-1173)]
* `_.reduceRight` should pass correct callback arguments when iterating objects [[test](https://github.com/bestiejs/lodash/blob/v0.5.2/test/test.js#L1121-1135)] * `_.reduceRight` should pass correct callback arguments when iterating objects [[test](https://github.com/bestiejs/lodash/blob/v0.6.1/test/test.js#L1205-1219)]
* `_.size` should return the `length` of string values [[test](https://github.com/bestiejs/lodash/blob/v0.5.2/test/test.js#L1179-1181)] * `_.size` should return the `length` of string values [[test](https://github.com/bestiejs/lodash/blob/v0.6.1/test/test.js#L1263-1265)]
* `_.sortedIndex` should support arrays with high `length` values [[test](https://github.com/bestiejs/lodash/blob/v0.5.2/test/test.js#L1269-1278)] * `_.sortedIndex` should support arrays with high `length` values [[test](https://github.com/bestiejs/lodash/blob/v0.6.1/test/test.js#L1353-1362)]
* `_.template` should not augment the `options` object [[test](https://github.com/bestiejs/lodash/blob/v0.5.2/test/test.js#L1293-1297)] * `_.template` should not augment the `options` object [[test](https://github.com/bestiejs/lodash/blob/v0.6.1/test/test.js#L1377-1381)]
* `_.throttle` should work when called in a loop [[#502](https://github.com/documentcloud/underscore/issues/502), [test](https://github.com/bestiejs/lodash/blob/v0.5.2/test/test.js#L1389-1399)] * `_.throttle` should work when called in a loop [[#502](https://github.com/documentcloud/underscore/issues/502), [test](https://github.com/bestiejs/lodash/blob/v0.6.1/test/test.js#L1473-1483)]
* `_.toArray` uses custom `toArray` methods of arrays and strings [[test](https://github.com/bestiejs/lodash/blob/v0.5.2/test/test.js#L1426-1434)] * `_.toArray` uses custom `toArray` methods of arrays and strings [[test](https://github.com/bestiejs/lodash/blob/v0.6.1/test/test.js#L1510-1518)]
* `_.zipObject` should accept less than two arguments [[test](https://github.com/bestiejs/lodash/blob/v0.5.2/test/test.js#L1520-1522)] * `_.zipObject` should accept less than two arguments [[test](https://github.com/bestiejs/lodash/blob/v0.6.1/test/test.js#L1630-1632)]
## Optimized methods <sup>(50+)</sup> ## Optimized methods <sup>(50+)</sup>
@@ -212,6 +214,7 @@ require({
* `_.defaults` * `_.defaults`
* `_.defer` * `_.defer`
* `_.difference` * `_.difference`
* `_.drop`, `_.omit`
* `_.each` * `_.each`
* `_.escape` * `_.escape`
* `_.every`, `_.all` * `_.every`, `_.all`
@@ -264,35 +267,21 @@ require({
## Release Notes ## Release Notes
### <sup>v0.5.2</sup> ### <sup>v0.6.1</sup>
* Ensured `_.isElement` uses strict equality for its duck type check * Ensured IE conditional compilation isnt enabled by the `useSourceURL` test
* Ensured `_.isObject` returns a boolean value * Optimized `isPlainObject`
* Ensured `_.template` and *“Objects”* methods dont error when passed falsey arguments
* Made `_.template` generate less unused code in compiled templates
### <sup>v0.5.1</sup> ### <sup>v0.6.0</sup>
* Ensured `_.bind` correctly appends array arguments to partially applied arguments in older browsers * Added `callback` and `thisArg` arguments to `_.drop` and `_.pick`
* Added `hasObjectSpliceBug` test to avoid `delete` operator use
### <sup>v0.5.0</sup> * Added `_.omit` alias for `_.drop`
* Added [_.unescape](http://lodash.com/docs#unescape)
* Added [_.countBy](http://lodash.com/docs#countBy), [_.drop](http://lodash.com/docs#drop), [_.merge](http://lodash.com/docs#merge), and [_.where](http://lodash.com/docs#where) * Ensured `_.reduce` works with string objects in IE < 9
* Added `csp` *(Content Security Policy)* and `underscore` build options * Made compiled methods take advantage of engines with strict mode optimizations
* Added `deep` cloning support to `_.clone` * Optimized `_.intersection` and removed its dependency on `_.every`
* Added [Jam](http://jamjs.org/) package support * Reduced the file size of the `underscore` build
* Added support for exiting `_.forEach`, `_.forIn`, and `_.forOwn` early by returning `false` in the `callback`
* Added support for jQuery/MooTools DOM query collections to `_.isEmpty` and `_.size`
* Ensured development build works with IE conditional compilation enabled
* Ensured `_.clone` doesnt clone functions, DOM nodes, `arguments` objects, and objects created by constructors other than `Object`
* Ensured `_.filter`s `callback` cant modify result values
* Ensured `_.isEmpty`, `_.isEquals`, and `_.size` support `arguments` objects
* Ensured `_.isEqual` doesnt inspect DOM nodes, works with objects from other documents, and calls custom `isEqual` methods before checking strict equality
* Ensured `_.once` frees the given function for garbage collection
* Ensured `_.sortBy` performs a stable sort
* Ensured `reEvaluateDelimiter` is assigned when `_.templateSettings.evaluate` is undefined
* Made `_.range` coerce arguments to numbers
* Optimized `_.isFunction`
The full changelog is available [here](https://github.com/bestiejs/lodash/wiki/Changelog). The full changelog is available [here](https://github.com/bestiejs/lodash/wiki/Changelog).

136
build.js
View File

@@ -2,6 +2,9 @@
;(function() { ;(function() {
'use strict'; 'use strict';
/** The debug version of `source` */
var debugSource;
/** Load modules */ /** Load modules */
var fs = require('fs'), var fs = require('fs'),
path = require('path'), path = require('path'),
@@ -20,8 +23,11 @@
/** Flag used to specify a legacy build */ /** Flag used to specify a legacy build */
var isLegacy = process.argv.indexOf('legacy') > -1; var isLegacy = process.argv.indexOf('legacy') > -1;
/** Flag used to specify an Underscore build */
var isUnderscore = process.argv.indexOf('underscore') > -1;
/** Flag used to specify a mobile build */ /** Flag used to specify a mobile build */
var isMobile = !isLegacy && (isCSP || process.argv.indexOf('mobile') > -1); var isMobile = !isLegacy && (isCSP || isUnderscore || process.argv.indexOf('mobile') > -1);
/** /**
* Flag used to specify `_.bindAll`, `_.extend`, and `_.defaults` are * Flag used to specify `_.bindAll`, `_.extend`, and `_.defaults` are
@@ -29,9 +35,6 @@
*/ */
var isStrict = process.argv.indexOf('strict') > -1; var isStrict = process.argv.indexOf('strict') > -1;
/** Flag used to specify an Underscore build */
var isUnderscore = process.argv.indexOf('underscore') > -1;
/** Flag used to specify if the build should include the "use strict" directive */ /** Flag used to specify if the build should include the "use strict" directive */
var useStrict = isStrict || !(isLegacy || isMobile); var useStrict = isStrict || !(isLegacy || isMobile);
@@ -47,19 +50,25 @@
if (isStrict) { if (isStrict) {
source = setUseStrictOption(source, true); source = setUseStrictOption(source, true);
} } else {
else if (!useStrict) {
source = removeUseStrictDirective(source); source = removeUseStrictDirective(source);
if (!useStrict) {
source = setUseStrictOption(source, false); source = setUseStrictOption(source, false);
} }
}
if (isLegacy) { if (isLegacy) {
source = replaceVar(source, 'noArgsClass', 'true'); source = replaceVar(source, 'noArgsClass', 'true');
['isBindFast', 'isKeysFast', 'nativeBind', 'nativeIsArray', 'nativeKeys'].forEach(function(varName) { ['isBindFast', 'isKeysFast', 'isStrictFast', 'nativeBind', 'nativeIsArray', 'nativeKeys'].forEach(function(varName) {
source = replaceVar(source, varName, 'false'); source = replaceVar(source, varName, 'false');
}); });
} }
else if (isMobile) { else if (isUnderscore) {
// remove `prototype` [[Enumerable]] fix from `iteratorTemplate`
source = source
.replace(/(?: *\/\/.*\n)*\s*' *(?:<% *)?if *\(!hasDontEnumBug *(?:&&|\))[\s\S]+?<% *} *(?:%>|').+/g, '')
.replace(/!hasDontEnumBug *\|\|/g, '');
}
if (isMobile) {
source = replaceVar(source, 'isKeysFast', 'false'); source = replaceVar(source, 'isKeysFast', 'false');
} }
vm.runInNewContext(source, sandbox); vm.runInNewContext(source, sandbox);
@@ -79,6 +88,7 @@
'include': 'contains', 'include': 'contains',
'inject': 'reduce', 'inject': 'reduce',
'methods': 'functions', 'methods': 'functions',
'omit': 'drop',
'select': 'filter', 'select': 'filter',
'tail': 'rest', 'tail': 'rest',
'take': 'first', 'take': 'first',
@@ -88,6 +98,7 @@
/** Used to associate real names with their aliases */ /** Used to associate real names with their aliases */
var realToAliasMap = { var realToAliasMap = {
'contains': ['include'], 'contains': ['include'],
'drop': ['omit'],
'every': ['all'], 'every': ['all'],
'filter': ['select'], 'filter': ['select'],
'find': ['detect'], 'find': ['detect'],
@@ -180,7 +191,7 @@
'identity': [], 'identity': [],
'indexOf': ['sortedIndex'], 'indexOf': ['sortedIndex'],
'initial': [], 'initial': [],
'intersection': ['every', 'indexOf'], 'intersection': ['indexOf'],
'invoke': [], 'invoke': [],
'isArguments': [], 'isArguments': [],
'isArray': [], 'isArray': [],
@@ -228,6 +239,7 @@
'throttle': [], 'throttle': [],
'times': [], 'times': [],
'toArray': ['isFunction', 'values'], 'toArray': ['isFunction', 'values'],
'unescape': [],
'union': ['indexOf'], 'union': ['indexOf'],
'uniq': ['identity', 'indexOf'], 'uniq': ['identity', 'indexOf'],
'uniqueId': [], 'uniqueId': [],
@@ -274,6 +286,7 @@
'forOwn', 'forOwn',
'merge', 'merge',
'partial', 'partial',
'unescape',
'where', 'where',
'zipObject' 'zipObject'
])); ]));
@@ -422,7 +435,7 @@
* @returns {String} Returns the `isArguments` fallback snippet. * @returns {String} Returns the `isArguments` fallback snippet.
*/ */
function getIsArgumentsFallback(source) { function getIsArgumentsFallback(source) {
return (source.match(/(?:\s*\/\/.*)*\s*if *\(noArgsClass[\s\S]+?};\s*}/) || [''])[0]; return (source.match(/(?:\s*\/\/.*)*\n( +)if *\(noArgsClass[\s\S]+?};\n\1}/) || [''])[0];
} }
/** /**
@@ -531,17 +544,6 @@
return removeFromCreateIterator(source, funcName); return removeFromCreateIterator(source, funcName);
} }
/**
* Removes the `_.isFunction` fallback from `source`.
*
* @private
* @param {String} source The source to process.
* @returns {String} Returns the source with the `isFunction` fallback removed.
*/
function removeIsFunctionFallback(source) {
return source.replace(/(?:\s*\/\/.*)*\s*if *\(isFunction\(\/x\/[\s\S]+?};\s*}/, '');
}
/** /**
* Removes the `_.isArguments` fallback from `source`. * Removes the `_.isArguments` fallback from `source`.
* *
@@ -553,6 +555,28 @@
return source.replace(getIsArgumentsFallback(source), ''); return source.replace(getIsArgumentsFallback(source), '');
} }
/**
* Removes the `_.isFunction` fallback from `source`.
*
* @private
* @param {String} source The source to process.
* @returns {String} Returns the source with the `isFunction` fallback removed.
*/
function removeIsFunctionFallback(source) {
return source.replace(/(?:\s*\/\/.*)*\n( +)if *\(isFunction\(\/x\/[\s\S]+?};\n\1}/, '');
}
/**
* Removes the `isPlainObject` fallback from `source`.
*
* @private
* @param {String} source The source to process.
* @returns {String} Returns the source with the `isPlainObject` fallback removed.
*/
function removeIsPlainObjectFallback(source) {
return source.replace(/(?:\s*\/\/.*)*\n( +)if *\(!isPlainObject[\s\S]+?};\n\1}/, '');
}
/** /**
* Removes the `Object.keys` object iteration optimization from `source`. * Removes the `Object.keys` object iteration optimization from `source`.
* *
@@ -683,11 +707,14 @@
* @returns {String} Returns the modified source. * @returns {String} Returns the modified source.
*/ */
function setUseStrictOption(source, value) { function setUseStrictOption(source, value) {
return source // remove `isStrictFast` assignment
return removeVar(source, 'isStrictFast')
// replace `useStrict` branch in `value` with hard-coded option // replace `useStrict` branch in `value` with hard-coded option
.replace(/(?: *\/\/.*\n)*(\s*)' *<% *if *\(useStrict\).+/, value ? "$1'\\'use strict\\';\\n' +" : '') .replace(/(?: *\/\/.*\n)*(\s*)' *<% *if *\(useStrict\).+/, value ? "$1'\\'use strict\\';\\n' +" : '')
// remove `useStrict` from iterator options // remove `useStrict` from iterator options
.replace(/ *'useStrict': *false,\n/g, '') .replace(/ *'useStrict': *false,\n/g, '')
// remove `useStrict` variable assignment in `createIterator`
.replace(/,\s*useStrict *=[^;]+/, '')
// remove `useStrict` data object property assignment in `createIterator` // remove `useStrict` data object property assignment in `createIterator`
.replace(/\s*.+?\.useStrict *=.+/, ''); .replace(/\s*.+?\.useStrict *=.+/, '');
} }
@@ -705,7 +732,7 @@
source = source.replace(/prototype\s*=\s*{\s*valueOf\s*:\s*1\s*}/, 'prototype={valueOf:1,y:1}'); source = source.replace(/prototype\s*=\s*{\s*valueOf\s*:\s*1\s*}/, 'prototype={valueOf:1,y:1}');
// re-remove "use strict" added by the minifier // re-remove "use strict" added by the minifier
if (!useStrict) { if (!isStrict) {
source = removeUseStrictDirective(source); source = removeUseStrictDirective(source);
} }
fs.writeFileSync(path.join(cwd, filename), source); fs.writeFileSync(path.join(cwd, filename), source);
@@ -968,7 +995,13 @@
return match.replace(/\bcallee\b/g, 'merge'); return match.replace(/\bcallee\b/g, 'merge');
}); });
// remove `hasDontEnumBug`, `iteratesOwnLast`, `noArgsEnum` assignment if (!isUnderscore) {
source = removeIsArgumentsFallback(source);
source = removeIsPlainObjectFallback(source);
source = removeNoArgsClass(source);
}
// remove `hasDontEnumBug`, `hasObjectSpliceBug`, `iteratesOwnLast`, `noArgsEnum` assignment
source = source.replace(/(?:\n +\/\*[^*]*\*+(?:[^\/][^*]*\*+)*\/)?\n *var hasDontEnumBug\b[\s\S]+?}\(1\)\);\n/, ''); source = source.replace(/(?:\n +\/\*[^*]*\*+(?:[^\/][^*]*\*+)*\/)?\n *var hasDontEnumBug\b[\s\S]+?}\(1\)\);\n/, '');
// remove `iteratesOwnLast` from `isPlainObject` // remove `iteratesOwnLast` from `isPlainObject`
@@ -977,8 +1010,8 @@
// remove JScript [[DontEnum]] fix from `_.isEqual` // remove JScript [[DontEnum]] fix from `_.isEqual`
source = source.replace(/(?:\s*\/\/.*)*\n( +)if *\(hasDontEnumBug[\s\S]+?\n\1}/, ''); source = source.replace(/(?:\s*\/\/.*)*\n( +)if *\(hasDontEnumBug[\s\S]+?\n\1}/, '');
// remove IE `shift` and `splice` fix from mutator Array functions mixin // remove `hasObjectSpliceBug` fix from the mutator Array functions mixin
source = source.replace(/(?:\s*\/\/.*)*\n( +)if *\(value.length *=== *0[\s\S]+?\n\1}/, ''); source = source.replace(/(?:\s*\/\/.*)*\n( +)if *\(hasObjectSpliceBug[\s\S]+?\n\1}/, '');
// remove `noArraySliceOnStrings` from `_.toArray` // remove `noArraySliceOnStrings` from `_.toArray`
source = source.replace(/noArraySliceOnStrings *\?[^:]+: *([^)]+)/g, '$1'); source = source.replace(/noArraySliceOnStrings *\?[^:]+: *([^)]+)/g, '$1');
@@ -990,9 +1023,7 @@
source = removeVar(source, 'iteratorTemplate'); source = removeVar(source, 'iteratorTemplate');
source = removeVar(source, 'noArraySliceOnStrings'); source = removeVar(source, 'noArraySliceOnStrings');
source = removeVar(source, 'noCharByIndex'); source = removeVar(source, 'noCharByIndex');
source = removeIsArgumentsFallback(source);
source = removeKeysOptimization(source); source = removeKeysOptimization(source);
source = removeNoArgsClass(source);
source = removeNoNodeClass(source); source = removeNoNodeClass(source);
} }
else { else {
@@ -1033,20 +1064,13 @@
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
// remove associated functions, variables, and code snippets that the minifier may miss // modify/remove references to removed methods/variables
if (isRemoved(source, 'bind')) { if (isRemoved(source, 'isArguments')) {
source = removeVar(source, 'nativeBind'); source = replaceVar(source, 'noArgsClass', 'false');
source = removeVar(source, 'isBindFast');
}
if (isRemoved(source, 'isArray')) {
source = removeVar(source, 'nativeIsArray');
} }
if (isRemoved(source, 'isFunction')) { if (isRemoved(source, 'isFunction')) {
source = removeIsFunctionFallback(source); source = removeIsFunctionFallback(source);
} }
if (isRemoved(source, 'keys')) {
source = removeFunction(source, 'shimKeys');
}
if (isRemoved(source, 'mixin')) { if (isRemoved(source, 'mixin')) {
// remove `LoDash` constructor // remove `LoDash` constructor
source = removeFunction(source, 'LoDash'); source = removeFunction(source, 'LoDash');
@@ -1054,6 +1078,23 @@
source = source.replace(/(?:new +LoDash(?!\()|(?:new +)?LoDash\([^)]*\));?/g, ''); source = source.replace(/(?:new +LoDash(?!\()|(?:new +)?LoDash\([^)]*\));?/g, '');
// remove `LoDash.prototype` additions // remove `LoDash.prototype` additions
source = source.replace(/(?:\s*\/\/.*)*\s*LoDash.prototype *=[\s\S]+?\/\*-+\*\//, ''); source = source.replace(/(?:\s*\/\/.*)*\s*LoDash.prototype *=[\s\S]+?\/\*-+\*\//, '');
// remove `hasObjectSpliceBug` assignment
source = source.replace(/(?:\n +\/\*[^*]*\*+(?:[^\/][^*]*\*+)*\/)?\n *var hasObjectSpliceBug;|.+?hasObjectSpliceBug *=.+/g, '');
}
// 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;
// remove associated functions, variables, and code snippets that the minifier may miss
if (isRemoved(source, 'isArray')) {
source = removeVar(source, 'nativeIsArray');
}
if (isRemoved(source, 'keys')) {
source = removeFunction(source, 'shimKeys');
} }
if (isRemoved(source, 'template')) { if (isRemoved(source, 'template')) {
// remove `templateSettings` assignment // remove `templateSettings` assignment
@@ -1075,10 +1116,16 @@
source = removeFunction(source, 'createIterator'); source = removeFunction(source, 'createIterator');
source = source.replace(/(?:\n +\/\*[^*]*\*+(?:[^\/][^*]*\*+)*\/)?\n *var noArgsEnum;|.+?noArgsEnum *=.+/g, ''); source = source.replace(/(?:\n +\/\*[^*]*\*+(?:[^\/][^*]*\*+)*\/)?\n *var noArgsEnum;|.+?noArgsEnum *=.+/g, '');
} }
if (isRemoved(source, 'createIterator', 'bind')) {
source = removeVar(source, 'isBindFast');
source = removeVar(source, 'isStrictFast');
source = removeVar(source, 'nativeBind');
}
if (isRemoved(source, 'createIterator', 'bind', 'isArray', 'keys')) { if (isRemoved(source, 'createIterator', 'bind', 'isArray', 'keys')) {
source = removeVar(source, 'reNative'); source = removeVar(source, 'reNative');
} }
if (isRemoved(source, 'createIterator', 'clone', 'merge')) { if (isRemoved(source, 'createIterator', 'clone', 'merge')) {
source = removeIsPlainObjectFallback(source);
source = source.replace(/(?:\n +\/\*[^*]*\*+(?:[^\/][^*]*\*+)*\/)?\n *var iteratesOwnLast;|.+?iteratesOwnLast *=.+/g, ''); source = source.replace(/(?:\n +\/\*[^*]*\*+(?:[^\/][^*]*\*+)*\/)?\n *var iteratesOwnLast;|.+?iteratesOwnLast *=.+/g, '');
} }
if (isRemoved(source, 'createIterator', 'isEqual')) { if (isRemoved(source, 'createIterator', 'isEqual')) {
@@ -1087,14 +1134,11 @@
if (isRemoved(source, 'createIterator', 'keys')) { if (isRemoved(source, 'createIterator', 'keys')) {
source = removeVar(source, 'nativeKeys'); source = removeVar(source, 'nativeKeys');
} }
if (!source.match(/var (?:hasDontEnumBug|iteratesOwnLast|noArgsEnum)\b/g)) { if (!source.match(/var (?:hasDontEnumBug|hasObjectSpliceBug|iteratesOwnLast|noArgsEnum)\b/g)) {
// remove `hasDontEnumBug`, `iteratesOwnLast`, `noArgsEnum` assignment // remove `hasDontEnumBug`, `hasObjectSpliceBug`, `iteratesOwnLast`, and `noArgsEnum` assignment
source = source.replace(/ *\(function\(\) *{\s*var props\b[\s\S]+?}\(1\)\);/, ''); source = source.replace(/ *\(function\(\) *{[\s\S]+?}\(1\)\);/, '');
} }
// remove pseudo private properties
source = source.replace(/(?:(?:\s*\/\/.*)*\s*lodash\._[^=]+=.+\n)+/g, '\n');
// consolidate consecutive horizontal rule comment separators // consolidate consecutive horizontal rule comment separators
source = source.replace(/(?:\s*\/\*-+\*\/\s*){2,}/g, function(separators) { source = source.replace(/(?:\s*\/\*-+\*\/\s*){2,}/g, function(separators) {
return separators.match(/^\s*/)[0] + separators.slice(separators.lastIndexOf('/*')); return separators.match(/^\s*/)[0] + separators.slice(separators.lastIndexOf('/*'));
@@ -1105,7 +1149,7 @@
// begin the minification process // begin the minification process
if (filterType || isBackbone || isLegacy || isMobile || isStrict || isUnderscore) { if (filterType || isBackbone || isLegacy || isMobile || isStrict || isUnderscore) {
writeFile(source, 'lodash.custom.js'); writeFile(debugSource, 'lodash.custom.js');
minify(source, 'lodash.custom.min', function(result) { minify(source, 'lodash.custom.min', function(result) {
writeFile(result, 'lodash.custom.min.js'); writeFile(result, 'lodash.custom.min.js');

View File

@@ -7,6 +7,8 @@
/** Used to minify variables embedded in compiled strings */ /** Used to minify variables embedded in compiled strings */
var compiledVars = [ var compiledVars = [
'argsIndex',
'argsLength',
'callback', 'callback',
'collection', 'collection',
'concat', 'concat',
@@ -36,8 +38,6 @@
// lesser used variables // lesser used variables
'accumulator', 'accumulator',
'args', 'args',
'argsIndex',
'argsLength',
'arrayLikeClasses', 'arrayLikeClasses',
'ArrayProto', 'ArrayProto',
'bind', 'bind',
@@ -106,6 +106,7 @@
'_', '_',
'_chain', '_chain',
'_wrapped', '_wrapped',
'__proto__',
'after', 'after',
'all', 'all',
'amd', 'amd',
@@ -132,7 +133,6 @@
'each', 'each',
'environment', 'environment',
'escape', 'escape',
'escape',
'evaluate', 'evaluate',
'every', 'every',
'extend', 'extend',
@@ -187,6 +187,7 @@
'min', 'min',
'mixin', 'mixin',
'noConflict', 'noConflict',
'omit',
'once', 'once',
'opera', 'opera',
'partial', 'partial',
@@ -214,6 +215,7 @@
'throttle', 'throttle',
'times', 'times',
'toArray', 'toArray',
'unescape',
'union', 'union',
'uniq', 'uniq',
'unique', 'unique',
@@ -276,7 +278,7 @@
// remove whitespace from string literals // remove whitespace from string literals
source = source.replace(/'(?:(?=(\\?))\1.)*?'/g, function(string) { source = source.replace(/'(?:(?=(\\?))\1.)*?'/g, function(string) {
// avoids removing the '\n' of the `stringEscapes` object // avoids removing the '\n' of the `stringEscapes` object
return string.replace(/\[object |else if|function | in |return\s+[\w']|throw |typeof |use strict|var |@ |'\\n'|\\\\n|\\n|\s+/g, function(match) { return string.replace(/\[object |delete |else if|function | in |return\s+[\w']|throw |typeof |use strict|var |@ |'\\n'|\\\\n|\\n|\s+/g, function(match) {
return match == false || match == '\\n' ? '' : match; return match == false || match == '\\n' ? '' : match;
}); });
}); });

View File

@@ -1,4 +1,4 @@
# Lo-Dash <sup>v0.5.2</sup> # Lo-Dash <sup>v0.6.1</sup>
<!-- div --> <!-- div -->
@@ -16,13 +16,13 @@
* [`_.compact`](#_compactarray) * [`_.compact`](#_compactarray)
* [`_.compose`](#_composefunc1-func2-) * [`_.compose`](#_composefunc1-func2-)
* [`_.contains`](#_containscollection-target) * [`_.contains`](#_containscollection-target)
* [`_.countBy`](#_countbycollection-callback--thisarg) * [`_.countBy`](#_countbycollection-callbackproperty--thisarg)
* [`_.debounce`](#_debouncefunc-wait-immediate) * [`_.debounce`](#_debouncefunc-wait-immediate)
* [`_.defaults`](#_defaultsobject--default1-default2-) * [`_.defaults`](#_defaultsobject--default1-default2-)
* [`_.defer`](#_deferfunc--arg1-arg2-) * [`_.defer`](#_deferfunc--arg1-arg2-)
* [`_.delay`](#_delayfunc-wait--arg1-arg2-) * [`_.delay`](#_delayfunc-wait--arg1-arg2-)
* [`_.difference`](#_differencearray--array1-array2-) * [`_.difference`](#_differencearray--array1-array2-)
* [`_.drop`](#_dropobject--prop1-prop2-) * [`_.drop`](#_dropobject-callback-prop1-prop2--thisarg)
* [`_.escape`](#_escapestring) * [`_.escape`](#_escapestring)
* [`_.every`](#_everycollection--callbackidentity-thisarg) * [`_.every`](#_everycollection--callbackidentity-thisarg)
* [`_.extend`](#_extendobject--source1-source2-) * [`_.extend`](#_extendobject--source1-source2-)
@@ -34,7 +34,7 @@
* [`_.forIn`](#_forinobject-callback--thisarg) * [`_.forIn`](#_forinobject-callback--thisarg)
* [`_.forOwn`](#_forownobject-callback--thisarg) * [`_.forOwn`](#_forownobject-callback--thisarg)
* [`_.functions`](#_functionsobject) * [`_.functions`](#_functionsobject)
* [`_.groupBy`](#_groupbycollection-callback--thisarg) * [`_.groupBy`](#_groupbycollection-callbackproperty--thisarg)
* [`_.has`](#_hasobject-property) * [`_.has`](#_hasobject-property)
* [`_.identity`](#_identityvalue) * [`_.identity`](#_identityvalue)
* [`_.indexOf`](#_indexofarray-value--fromindex0) * [`_.indexOf`](#_indexofarray-value--fromindex0)
@@ -69,7 +69,7 @@
* [`_.noConflict`](#_noconflict) * [`_.noConflict`](#_noconflict)
* [`_.once`](#_oncefunc) * [`_.once`](#_oncefunc)
* [`_.partial`](#_partialfunc--arg1-arg2-) * [`_.partial`](#_partialfunc--arg1-arg2-)
* [`_.pick`](#_pickobject--prop1-prop2-) * [`_.pick`](#_pickobject-callback-prop1-prop2--thisarg)
* [`_.pluck`](#_pluckcollection-property) * [`_.pluck`](#_pluckcollection-property)
* [`_.range`](#_rangestart0-end--step1) * [`_.range`](#_rangestart0-end--step1)
* [`_.reduce`](#_reducecollection-callback--accumulator-thisarg) * [`_.reduce`](#_reducecollection-callback--accumulator-thisarg)
@@ -80,13 +80,14 @@
* [`_.shuffle`](#_shufflearray) * [`_.shuffle`](#_shufflearray)
* [`_.size`](#_sizevalue) * [`_.size`](#_sizevalue)
* [`_.some`](#_somecollection--callbackidentity-thisarg) * [`_.some`](#_somecollection--callbackidentity-thisarg)
* [`_.sortBy`](#_sortbycollection-callback--thisarg) * [`_.sortBy`](#_sortbycollection-callbackproperty--thisarg)
* [`_.sortedIndex`](#_sortedindexarray-value--callbackidentity-thisarg) * [`_.sortedIndex`](#_sortedindexarray-value--callbackidentity-thisarg)
* [`_.tap`](#_tapvalue-interceptor) * [`_.tap`](#_tapvalue-interceptor)
* [`_.template`](#_templatetext-data-options) * [`_.template`](#_templatetext-data-options)
* [`_.throttle`](#_throttlefunc-wait) * [`_.throttle`](#_throttlefunc-wait)
* [`_.times`](#_timesn-callback--thisarg) * [`_.times`](#_timesn-callback--thisarg)
* [`_.toArray`](#_toarraycollection) * [`_.toArray`](#_toarraycollection)
* [`_.unescape`](#_unescapestring)
* [`_.union`](#_unionarray1-array2-) * [`_.union`](#_unionarray1-array2-)
* [`_.uniq`](#_uniqarray--issortedfalse-callbackidentity-thisarg) * [`_.uniq`](#_uniqarray--issortedfalse-callbackidentity-thisarg)
* [`_.uniqueId`](#_uniqueidprefix) * [`_.uniqueId`](#_uniqueidprefix)
@@ -121,6 +122,14 @@
<!-- /div --> <!-- /div -->
<!-- div -->
## ``
* [``](#)
<!-- /div -->
<!-- /div --> <!-- /div -->
@@ -134,7 +143,7 @@
<!-- div --> <!-- div -->
### <a id="_value"></a>`_(value)` ### <a id="_value"></a>`_(value)`
<a href="#_value">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L249 "View in source") [&#x24C9;][1] <a href="#_value">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L292 "View in source") [&#x24C9;][1]
The `lodash` function. The `lodash` function.
@@ -152,7 +161,7 @@ The `lodash` function.
<!-- div --> <!-- div -->
### <a id="_version"></a>`_.VERSION` ### <a id="_version"></a>`_.VERSION`
<a href="#_version">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4064 "View in source") [&#x24C9;][1] <a href="#_version">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4171 "View in source") [&#x24C9;][1]
*(String)*: The semantic version number. *(String)*: The semantic version number.
@@ -164,7 +173,7 @@ The `lodash` function.
<!-- div --> <!-- div -->
### <a id="_aftern-func"></a>`_.after(n, func)` ### <a id="_aftern-func"></a>`_.after(n, func)`
<a href="#_aftern-func">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3151 "View in source") [&#x24C9;][1] <a href="#_aftern-func">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3240 "View in source") [&#x24C9;][1]
Creates a new function that is restricted to executing only after it is called `n` times. Creates a new function that is restricted to executing only after it is called `n` times.
@@ -192,7 +201,7 @@ _.forEach(notes, function(note) {
<!-- div --> <!-- div -->
### <a id="_bindfunc--thisarg-arg1-arg2-"></a>`_.bind(func [, thisArg, arg1, arg2, ...])` ### <a id="_bindfunc--thisarg-arg1-arg2-"></a>`_.bind(func [, thisArg, arg1, arg2, ...])`
<a href="#_bindfunc--thisarg-arg1-arg2-">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3205 "View in source") [&#x24C9;][1] <a href="#_bindfunc--thisarg-arg1-arg2-">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3294 "View in source") [&#x24C9;][1]
Creates a new function that, when called, invokes `func` with the `this` binding of `thisArg` and prepends any additional `bind` arguments to those passed to the bound function. Lazy defined methods may be bound by passing the object they are bound to as `func` and the method name as `thisArg`. Creates a new function that, when called, invokes `func` with the `this` binding of `thisArg` and prepends any additional `bind` arguments to those passed to the bound function. Lazy defined methods may be bound by passing the object they are bound to as `func` and the method name as `thisArg`.
@@ -243,7 +252,7 @@ func();
<!-- div --> <!-- div -->
### <a id="_bindallobject--methodname1-methodname2-"></a>`_.bindAll(object [, methodName1, methodName2, ...])` ### <a id="_bindallobject--methodname1-methodname2-"></a>`_.bindAll(object [, methodName1, methodName2, ...])`
<a href="#_bindallobject--methodname1-methodname2-">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3275 "View in source") [&#x24C9;][1] <a href="#_bindallobject--methodname1-methodname2-">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3364 "View in source") [&#x24C9;][1]
Binds methods on `object` to `object`, overwriting the existing method. If no method names are provided, all the function properties of `object` will be bound. Binds methods on `object` to `object`, overwriting the existing method. If no method names are provided, all the function properties of `object` will be bound.
@@ -274,7 +283,7 @@ jQuery('#lodash_button').on('click', buttonView.onClick);
<!-- div --> <!-- div -->
### <a id="_chainvalue"></a>`_.chain(value)` ### <a id="_chainvalue"></a>`_.chain(value)`
<a href="#_chainvalue">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3989 "View in source") [&#x24C9;][1] <a href="#_chainvalue">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4096 "View in source") [&#x24C9;][1]
Wraps the value in a `lodash` wrapper object. Wraps the value in a `lodash` wrapper object.
@@ -308,7 +317,7 @@ var youngest = _.chain(stooges)
<!-- div --> <!-- div -->
### <a id="_clonevalue-deep--guard-stack-thorough"></a>`_.clone(value, deep [, guard, stack=[]], thorough)` ### <a id="_clonevalue-deep--guard-stack-thorough"></a>`_.clone(value, deep [, guard, stack=[]], thorough)`
<a href="#_clonevalue-deep--guard-stack-thorough">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L992 "View in source") [&#x24C9;][1] <a href="#_clonevalue-deep--guard-stack-thorough">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1070 "View in source") [&#x24C9;][1]
Creates a clone of `value`. If `deep` is `true`, all nested objects will also be cloned otherwise they will be assigned by reference. If a value has a `clone` method it will be used to perform the clone. Functions, DOM nodes, `arguments` objects, and objects created by constructors other than `Object` are **not** cloned unless they have a custom `clone` method. Creates a clone of `value`. If `deep` is `true`, all nested objects will also be cloned otherwise they will be assigned by reference. If a value has a `clone` method it will be used to perform the clone. Functions, DOM nodes, `arguments` objects, and objects created by constructors other than `Object` are **not** cloned unless they have a custom `clone` method.
@@ -350,7 +359,7 @@ shallow[0] === stooges[0];
<!-- div --> <!-- div -->
### <a id="_compactarray"></a>`_.compact(array)` ### <a id="_compactarray"></a>`_.compact(array)`
<a href="#_compactarray">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2390 "View in source") [&#x24C9;][1] <a href="#_compactarray">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2477 "View in source") [&#x24C9;][1]
Creates a new array with all falsey values of `array` removed. The values `false`, `null`, `0`, `""`, `undefined` and `NaN` are all falsey. Creates a new array with all falsey values of `array` removed. The values `false`, `null`, `0`, `""`, `undefined` and `NaN` are all falsey.
@@ -374,7 +383,7 @@ _.compact([0, 1, false, 2, '', 3]);
<!-- div --> <!-- div -->
### <a id="_composefunc1-func2-"></a>`_.compose([func1, func2, ...])` ### <a id="_composefunc1-func2-"></a>`_.compose([func1, func2, ...])`
<a href="#_composefunc1-func2-">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3313 "View in source") [&#x24C9;][1] <a href="#_composefunc1-func2-">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3402 "View in source") [&#x24C9;][1]
Creates a new function that is the composition of the passed functions, where each function consumes the return value of the function that follows. In math terms, composing the functions `f()`, `g()`, and `h()` produces `f(g(h()))`. Creates a new function that is the composition of the passed functions, where each function consumes the return value of the function that follows. In math terms, composing the functions `f()`, `g()`, and `h()` produces `f(g(h()))`.
@@ -401,7 +410,7 @@ welcome('moe');
<!-- div --> <!-- div -->
### <a id="_containscollection-target"></a>`_.contains(collection, target)` ### <a id="_containscollection-target"></a>`_.contains(collection, target)`
<a href="#_containscollection-target">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1874 "View in source") [&#x24C9;][1] <a href="#_containscollection-target">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1961 "View in source") [&#x24C9;][1]
Checks if a given `target` element is present in a `collection` using strict equality for comparisons, i.e. `===`. Checks if a given `target` element is present in a `collection` using strict equality for comparisons, i.e. `===`.
@@ -431,14 +440,14 @@ _.contains('curly', 'ur');
<!-- div --> <!-- div -->
### <a id="_countbycollection-callback--thisarg"></a>`_.countBy(collection, callback [, thisArg])` ### <a id="_countbycollection-callbackproperty--thisarg"></a>`_.countBy(collection, callback|property [, thisArg])`
<a href="#_countbycollection-callback--thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1910 "View in source") [&#x24C9;][1] <a href="#_countbycollection-callbackproperty--thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1997 "View in source") [&#x24C9;][1]
Creates an object composed of keys returned from running each element of `collection` through a `callback`. The corresponding value of each key is the number of times the key was returned by `callback`. The `callback` is bound to `thisArg` and invoked with `3` arguments; *(value, index|key, collection)*. The `callback` argument may also be the name of a property to count by *(e.g. 'length')*. Creates an object composed of keys returned from running each element of `collection` through a `callback`. The corresponding value of each key is the number of times the key was returned by `callback`. The `callback` is bound to `thisArg` and invoked with `3` arguments; *(value, index|key, collection)*. The `callback` argument may also be the name of a property to count by *(e.g. 'length')*.
#### Arguments #### Arguments
1. `collection` *(Array|Object|String)*: The collection to iterate over. 1. `collection` *(Array|Object|String)*: The collection to iterate over.
2. `callback` *(Function|String)*: The function called per iteration or property name to count by. 2. `callback|property` *(Function|String)*: The function called per iteration or property name to count by.
3. `[thisArg]` *(Mixed)*: The `this` binding for the callback. 3. `[thisArg]` *(Mixed)*: The `this` binding for the callback.
#### Returns #### Returns
@@ -464,7 +473,7 @@ _.countBy(['one', 'two', 'three'], 'length');
<!-- div --> <!-- div -->
### <a id="_debouncefunc-wait-immediate"></a>`_.debounce(func, wait, immediate)` ### <a id="_debouncefunc-wait-immediate"></a>`_.debounce(func, wait, immediate)`
<a href="#_debouncefunc-wait-immediate">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3346 "View in source") [&#x24C9;][1] <a href="#_debouncefunc-wait-immediate">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3435 "View in source") [&#x24C9;][1]
Creates a new function that will delay the execution of `func` until after `wait` milliseconds have elapsed since the last time it was invoked. Pass `true` for `immediate` to cause debounce to invoke `func` on the leading, instead of the trailing, edge of the `wait` timeout. Subsequent calls to the debounced function will return the result of the last `func` call. Creates a new function that will delay the execution of `func` until after `wait` milliseconds have elapsed since the last time it was invoked. Pass `true` for `immediate` to cause debounce to invoke `func` on the leading, instead of the trailing, edge of the `wait` timeout. Subsequent calls to the debounced function will return the result of the last `func` call.
@@ -490,7 +499,7 @@ jQuery(window).on('resize', lazyLayout);
<!-- div --> <!-- div -->
### <a id="_defaultsobject--default1-default2-"></a>`_.defaults(object [, default1, default2, ...])` ### <a id="_defaultsobject--default1-default2-"></a>`_.defaults(object [, default1, default2, ...])`
<a href="#_defaultsobject--default1-default2-">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1093 "View in source") [&#x24C9;][1] <a href="#_defaultsobject--default1-default2-">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1171 "View in source") [&#x24C9;][1]
Assigns enumerable properties of the default object(s) to the `destination` object for all `destination` properties that resolve to `null`/`undefined`. Once a property is set, additional defaults of the same property will be ignored. Assigns enumerable properties of the default object(s) to the `destination` object for all `destination` properties that resolve to `null`/`undefined`. Once a property is set, additional defaults of the same property will be ignored.
@@ -516,7 +525,7 @@ _.defaults(iceCream, { 'flavor': 'vanilla', 'sprinkles': 'rainbow' });
<!-- div --> <!-- div -->
### <a id="_deferfunc--arg1-arg2-"></a>`_.defer(func [, arg1, arg2, ...])` ### <a id="_deferfunc--arg1-arg2-"></a>`_.defer(func [, arg1, arg2, ...])`
<a href="#_deferfunc--arg1-arg2-">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3411 "View in source") [&#x24C9;][1] <a href="#_deferfunc--arg1-arg2-">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3500 "View in source") [&#x24C9;][1]
Defers executing the `func` function until the current call stack has cleared. Additional arguments will be passed to `func` when it is invoked. Defers executing the `func` function until the current call stack has cleared. Additional arguments will be passed to `func` when it is invoked.
@@ -541,7 +550,7 @@ _.defer(function() { alert('deferred'); });
<!-- div --> <!-- div -->
### <a id="_delayfunc-wait--arg1-arg2-"></a>`_.delay(func, wait [, arg1, arg2, ...])` ### <a id="_delayfunc-wait--arg1-arg2-"></a>`_.delay(func, wait [, arg1, arg2, ...])`
<a href="#_delayfunc-wait--arg1-arg2-">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3391 "View in source") [&#x24C9;][1] <a href="#_delayfunc-wait--arg1-arg2-">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3480 "View in source") [&#x24C9;][1]
Executes the `func` function after `wait` milliseconds. Additional arguments will be passed to `func` when it is invoked. Executes the `func` function after `wait` milliseconds. Additional arguments will be passed to `func` when it is invoked.
@@ -568,7 +577,7 @@ _.delay(log, 1000, 'logged later');
<!-- div --> <!-- div -->
### <a id="_differencearray--array1-array2-"></a>`_.difference(array [, array1, array2, ...])` ### <a id="_differencearray--array1-array2-"></a>`_.difference(array [, array1, array2, ...])`
<a href="#_differencearray--array1-array2-">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2422 "View in source") [&#x24C9;][1] <a href="#_differencearray--array1-array2-">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2509 "View in source") [&#x24C9;][1]
Creates a new array of `array` elements not present in the other arrays using strict equality for comparisons, i.e. `===`. Creates a new array of `array` elements not present in the other arrays using strict equality for comparisons, i.e. `===`.
@@ -592,14 +601,15 @@ _.difference([1, 2, 3, 4, 5], [5, 2, 10]);
<!-- div --> <!-- div -->
### <a id="_dropobject--prop1-prop2-"></a>`_.drop(object [, prop1, prop2, ...])` ### <a id="_dropobject-callback-prop1-prop2--thisarg"></a>`_.drop(object, callback|[prop1, prop2, ..., thisArg])`
<a href="#_dropobject--prop1-prop2-">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1113 "View in source") [&#x24C9;][1] <a href="#_dropobject-callback-prop1-prop2--thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1201 "View in source") [&#x24C9;][1]
Creates a shallow clone of `object` excluding the specified properties. Property names may be specified as individual arguments or as arrays of property names. Creates a shallow clone of `object` excluding the specified properties. Property names may be specified as individual arguments or as arrays of property names. If `callback` is passed, it will be executed for each property in the `object`, dropping the properties `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with `3` arguments; *(value, key, object)*.
#### Arguments #### Arguments
1. `object` *(Object)*: The source object. 1. `object` *(Object)*: The source object.
2. `[prop1, prop2, ...]` *(Object)*: The properties to drop. 2. `callback|[prop1, prop2, ...]` *(Function|String)*: The properties to drop or the function called per iteration.
3. `[thisArg]` *(Mixed)*: The `this` binding for the callback.
#### Returns #### Returns
*(Object)*: Returns an object without the dropped properties. *(Object)*: Returns an object without the dropped properties.
@@ -608,6 +618,11 @@ Creates a shallow clone of `object` excluding the specified properties. Property
```js ```js
_.drop({ 'name': 'moe', 'age': 40, 'userid': 'moe1' }, 'userid'); _.drop({ 'name': 'moe', 'age': 40, 'userid': 'moe1' }, 'userid');
// => { 'name': 'moe', 'age': 40 } // => { 'name': 'moe', 'age': 40 }
_.drop({ 'name': 'moe', '_hint': 'knucklehead', '_seed': '96c4eb' }, function(value, key) {
return key.charAt(0) == '_';
});
// => { 'name': 'moe' }
``` ```
* * * * * *
@@ -618,9 +633,9 @@ _.drop({ 'name': 'moe', 'age': 40, 'userid': 'moe1' }, 'userid');
<!-- div --> <!-- div -->
### <a id="_escapestring"></a>`_.escape(string)` ### <a id="_escapestring"></a>`_.escape(string)`
<a href="#_escapestring">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3608 "View in source") [&#x24C9;][1] <a href="#_escapestring">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3697 "View in source") [&#x24C9;][1]
Escapes a string for inclusion in HTML, replacing `&`, `<`, `"`, and `'` characters. Converts the characters `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding HTML entities.
#### Arguments #### Arguments
1. `string` *(String)*: The string to escape. 1. `string` *(String)*: The string to escape.
@@ -642,7 +657,7 @@ _.escape('Moe, Larry & Curly');
<!-- div --> <!-- div -->
### <a id="_everycollection--callbackidentity-thisarg"></a>`_.every(collection [, callback=identity, thisArg])` ### <a id="_everycollection--callbackidentity-thisarg"></a>`_.every(collection [, callback=identity, thisArg])`
<a href="#_everycollection--callbackidentity-thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1930 "View in source") [&#x24C9;][1] <a href="#_everycollection--callbackidentity-thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2017 "View in source") [&#x24C9;][1]
Checks if the `callback` returns a truthy value for **all** elements of a `collection`. The `callback` is bound to `thisArg` and invoked with `3` arguments; *(value, index|key, collection)*. Checks if the `callback` returns a truthy value for **all** elements of a `collection`. The `callback` is bound to `thisArg` and invoked with `3` arguments; *(value, index|key, collection)*.
@@ -668,7 +683,7 @@ _.every([true, 1, null, 'yes'], Boolean);
<!-- div --> <!-- div -->
### <a id="_extendobject--source1-source2-"></a>`_.extend(object [, source1, source2, ...])` ### <a id="_extendobject--source1-source2-"></a>`_.extend(object [, source1, source2, ...])`
<a href="#_extendobject--source1-source2-">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1137 "View in source") [&#x24C9;][1] <a href="#_extendobject--source1-source2-">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1219 "View in source") [&#x24C9;][1]
Assigns enumerable properties of the source object(s) to the `destination` object. Subsequent sources will overwrite propery assignments of previous sources. Assigns enumerable properties of the source object(s) to the `destination` object. Subsequent sources will overwrite propery assignments of previous sources.
@@ -693,7 +708,7 @@ _.extend({ 'name': 'moe' }, { 'age': 40 });
<!-- div --> <!-- div -->
### <a id="_filtercollection--callbackidentity-thisarg"></a>`_.filter(collection [, callback=identity, thisArg])` ### <a id="_filtercollection--callbackidentity-thisarg"></a>`_.filter(collection [, callback=identity, thisArg])`
<a href="#_filtercollection--callbackidentity-thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1950 "View in source") [&#x24C9;][1] <a href="#_filtercollection--callbackidentity-thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2037 "View in source") [&#x24C9;][1]
Examines each element in a `collection`, returning an array of all elements the `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with `3` arguments; *(value, index|key, collection)*. Examines each element in a `collection`, returning an array of all elements the `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with `3` arguments; *(value, index|key, collection)*.
@@ -719,7 +734,7 @@ var evens = _.filter([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; })
<!-- div --> <!-- div -->
### <a id="_findcollection-callback--thisarg"></a>`_.find(collection, callback [, thisArg])` ### <a id="_findcollection-callback--thisarg"></a>`_.find(collection, callback [, thisArg])`
<a href="#_findcollection-callback--thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1971 "View in source") [&#x24C9;][1] <a href="#_findcollection-callback--thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2058 "View in source") [&#x24C9;][1]
Examines each element in a `collection`, returning the first one the `callback` returns truthy for. The function returns as soon as it finds an acceptable element, and does not iterate over the entire `collection`. The `callback` is bound to `thisArg` and invoked with `3` arguments; *(value, index|key, collection)*. Examines each element in a `collection`, returning the first one the `callback` returns truthy for. The function returns as soon as it finds an acceptable element, and does not iterate over the entire `collection`. The `callback` is bound to `thisArg` and invoked with `3` arguments; *(value, index|key, collection)*.
@@ -745,7 +760,7 @@ var even = _.find([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; });
<!-- div --> <!-- div -->
### <a id="_firstarray--n-guard"></a>`_.first(array [, n, guard])` ### <a id="_firstarray--n-guard"></a>`_.first(array [, n, guard])`
<a href="#_firstarray--n-guard">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2459 "View in source") [&#x24C9;][1] <a href="#_firstarray--n-guard">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2546 "View in source") [&#x24C9;][1]
Gets the first element of the `array`. Pass `n` to return the first `n` elements of the `array`. Gets the first element of the `array`. Pass `n` to return the first `n` elements of the `array`.
@@ -771,7 +786,7 @@ _.first([5, 4, 3, 2, 1]);
<!-- div --> <!-- div -->
### <a id="_flattenarray-shallow"></a>`_.flatten(array, shallow)` ### <a id="_flattenarray-shallow"></a>`_.flatten(array, shallow)`
<a href="#_flattenarray-shallow">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2483 "View in source") [&#x24C9;][1] <a href="#_flattenarray-shallow">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2570 "View in source") [&#x24C9;][1]
Flattens a nested array *(the nesting can be to any depth)*. If `shallow` is truthy, `array` will only be flattened a single level. Flattens a nested array *(the nesting can be to any depth)*. If `shallow` is truthy, `array` will only be flattened a single level.
@@ -799,7 +814,7 @@ _.flatten([1, [2], [3, [[4]]]], true);
<!-- div --> <!-- div -->
### <a id="_foreachcollection-callback--thisarg"></a>`_.forEach(collection, callback [, thisArg])` ### <a id="_foreachcollection-callback--thisarg"></a>`_.forEach(collection, callback [, thisArg])`
<a href="#_foreachcollection-callback--thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1998 "View in source") [&#x24C9;][1] <a href="#_foreachcollection-callback--thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2085 "View in source") [&#x24C9;][1]
Iterates over a `collection`, executing the `callback` for each element in the `collection`. The `callback` is bound to `thisArg` and invoked with `3` arguments; *(value, index|key, collection)*. Callbacks may exit iteration early by explicitly returning `false`. Iterates over a `collection`, executing the `callback` for each element in the `collection`. The `callback` is bound to `thisArg` and invoked with `3` arguments; *(value, index|key, collection)*. Callbacks may exit iteration early by explicitly returning `false`.
@@ -828,7 +843,7 @@ _.forEach({ 'one': 1, 'two': 2, 'three': 3 }, alert);
<!-- div --> <!-- div -->
### <a id="_forinobject-callback--thisarg"></a>`_.forIn(object, callback [, thisArg])` ### <a id="_forinobject-callback--thisarg"></a>`_.forIn(object, callback [, thisArg])`
<a href="#_forinobject-callback--thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1167 "View in source") [&#x24C9;][1] <a href="#_forinobject-callback--thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1249 "View in source") [&#x24C9;][1]
Iterates over `object`'s own and inherited enumerable properties, executing the `callback` for each property. The `callback` is bound to `thisArg` and invoked with `3` arguments; *(value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`. Iterates over `object`'s own and inherited enumerable properties, executing the `callback` for each property. The `callback` is bound to `thisArg` and invoked with `3` arguments; *(value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`.
@@ -864,7 +879,7 @@ _.forIn(new Dog('Dagny'), function(value, key) {
<!-- div --> <!-- div -->
### <a id="_forownobject-callback--thisarg"></a>`_.forOwn(object, callback [, thisArg])` ### <a id="_forownobject-callback--thisarg"></a>`_.forOwn(object, callback [, thisArg])`
<a href="#_forownobject-callback--thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1191 "View in source") [&#x24C9;][1] <a href="#_forownobject-callback--thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1273 "View in source") [&#x24C9;][1]
Iterates over `object`'s own enumerable properties, executing the `callback` for each property. The `callback` is bound to `thisArg` and invoked with `3` arguments; *(value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`. Iterates over `object`'s own enumerable properties, executing the `callback` for each property. The `callback` is bound to `thisArg` and invoked with `3` arguments; *(value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`.
@@ -892,7 +907,7 @@ _.forOwn({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) {
<!-- div --> <!-- div -->
### <a id="_functionsobject"></a>`_.functions(object)` ### <a id="_functionsobject"></a>`_.functions(object)`
<a href="#_functionsobject">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1208 "View in source") [&#x24C9;][1] <a href="#_functionsobject">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1290 "View in source") [&#x24C9;][1]
Creates a sorted array of all enumerable properties, own and inherited, of `object` that have function values. Creates a sorted array of all enumerable properties, own and inherited, of `object` that have function values.
@@ -915,14 +930,14 @@ _.functions(_);
<!-- div --> <!-- div -->
### <a id="_groupbycollection-callback--thisarg"></a>`_.groupBy(collection, callback [, thisArg])` ### <a id="_groupbycollection-callbackproperty--thisarg"></a>`_.groupBy(collection, callback|property [, thisArg])`
<a href="#_groupbycollection-callback--thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2026 "View in source") [&#x24C9;][1] <a href="#_groupbycollection-callbackproperty--thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2113 "View in source") [&#x24C9;][1]
Creates an object composed of keys returned from running each element of `collection` through a `callback`. The corresponding value of each key is an array of elements passed to `callback` that returned the key. The `callback` is bound to `thisArg` and invoked with `3` arguments; *(value, index|key, collection)*. The `callback` argument may also be the name of a property to count by *(e.g. 'length')*. Creates an object composed of keys returned from running each element of `collection` through a `callback`. The corresponding value of each key is an array of elements passed to `callback` that returned the key. The `callback` is bound to `thisArg` and invoked with `3` arguments; *(value, index|key, collection)*. The `callback` argument may also be the name of a property to count by *(e.g. 'length')*.
#### Arguments #### Arguments
1. `collection` *(Array|Object|String)*: The collection to iterate over. 1. `collection` *(Array|Object|String)*: The collection to iterate over.
2. `callback` *(Function|String)*: The function called per iteration or property name to group by. 2. `callback|property` *(Function|String)*: The function called per iteration or property name to group by.
3. `[thisArg]` *(Mixed)*: The `this` binding for the callback. 3. `[thisArg]` *(Mixed)*: The `this` binding for the callback.
#### Returns #### Returns
@@ -948,7 +963,7 @@ _.groupBy(['one', 'two', 'three'], 'length');
<!-- div --> <!-- div -->
### <a id="_hasobject-property"></a>`_.has(object, property)` ### <a id="_hasobject-property"></a>`_.has(object, property)`
<a href="#_hasobject-property">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1231 "View in source") [&#x24C9;][1] <a href="#_hasobject-property">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1313 "View in source") [&#x24C9;][1]
Checks if the specified object `property` exists and is a direct property, instead of an inherited property. Checks if the specified object `property` exists and is a direct property, instead of an inherited property.
@@ -973,7 +988,7 @@ _.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b');
<!-- div --> <!-- div -->
### <a id="_identityvalue"></a>`_.identity(value)` ### <a id="_identityvalue"></a>`_.identity(value)`
<a href="#_identityvalue">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3628 "View in source") [&#x24C9;][1] <a href="#_identityvalue">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3717 "View in source") [&#x24C9;][1]
This function returns the first argument passed to it. Note: It is used throughout Lo-Dash as a default callback. This function returns the first argument passed to it. Note: It is used throughout Lo-Dash as a default callback.
@@ -998,7 +1013,7 @@ moe === _.identity(moe);
<!-- div --> <!-- div -->
### <a id="_indexofarray-value--fromindex0"></a>`_.indexOf(array, value [, fromIndex=0])` ### <a id="_indexofarray-value--fromindex0"></a>`_.indexOf(array, value [, fromIndex=0])`
<a href="#_indexofarray-value--fromindex0">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2527 "View in source") [&#x24C9;][1] <a href="#_indexofarray-value--fromindex0">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2614 "View in source") [&#x24C9;][1]
Gets the index at which the first occurrence of `value` is found using strict equality for comparisons, i.e. `===`. If the `array` is already sorted, passing `true` for `isSorted` will run a faster binary search. Gets the index at which the first occurrence of `value` is found using strict equality for comparisons, i.e. `===`. If the `array` is already sorted, passing `true` for `isSorted` will run a faster binary search.
@@ -1030,7 +1045,7 @@ _.indexOf([1, 1, 2, 2, 3, 3], 2, true);
<!-- div --> <!-- div -->
### <a id="_initialarray--n-guard"></a>`_.initial(array [, n, guard])` ### <a id="_initialarray--n-guard"></a>`_.initial(array [, n, guard])`
<a href="#_initialarray--n-guard">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2567 "View in source") [&#x24C9;][1] <a href="#_initialarray--n-guard">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2654 "View in source") [&#x24C9;][1]
Gets all but the last element of `array`. Pass `n` to exclude the last `n` elements from the result. Gets all but the last element of `array`. Pass `n` to exclude the last `n` elements from the result.
@@ -1056,7 +1071,7 @@ _.initial([3, 2, 1]);
<!-- div --> <!-- div -->
### <a id="_intersectionarray1-array2-"></a>`_.intersection([array1, array2, ...])` ### <a id="_intersectionarray1-array2-"></a>`_.intersection([array1, array2, ...])`
<a href="#_intersectionarray1-array2-">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2589 "View in source") [&#x24C9;][1] <a href="#_intersectionarray1-array2-">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2676 "View in source") [&#x24C9;][1]
Computes the intersection of all the passed-in arrays using strict equality for comparisons, i.e. `===`. Computes the intersection of all the passed-in arrays using strict equality for comparisons, i.e. `===`.
@@ -1080,7 +1095,7 @@ _.intersection([1, 2, 3], [101, 2, 1, 10], [2, 1]);
<!-- div --> <!-- div -->
### <a id="_invokecollection-methodname--arg1-arg2-"></a>`_.invoke(collection, methodName [, arg1, arg2, ...])` ### <a id="_invokecollection-methodname--arg1-arg2-"></a>`_.invoke(collection, methodName [, arg1, arg2, ...])`
<a href="#_invokecollection-methodname--arg1-arg2-">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2054 "View in source") [&#x24C9;][1] <a href="#_invokecollection-methodname--arg1-arg2-">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2141 "View in source") [&#x24C9;][1]
Invokes the method named by `methodName` on each element in the `collection`. Additional arguments will be passed to each invoked method. If `methodName` is a function it will be invoked for, and `this` bound to, each element in the `collection`. Invokes the method named by `methodName` on each element in the `collection`. Additional arguments will be passed to each invoked method. If `methodName` is a function it will be invoked for, and `this` bound to, each element in the `collection`.
@@ -1109,7 +1124,7 @@ _.invoke([123, 456], String.prototype.split, '');
<!-- div --> <!-- div -->
### <a id="_isargumentsvalue"></a>`_.isArguments(value)` ### <a id="_isargumentsvalue"></a>`_.isArguments(value)`
<a href="#_isargumentsvalue">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L885 "View in source") [&#x24C9;][1] <a href="#_isargumentsvalue">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L910 "View in source") [&#x24C9;][1]
Checks if `value` is an `arguments` object. Checks if `value` is an `arguments` object.
@@ -1136,7 +1151,7 @@ _.isArguments([1, 2, 3]);
<!-- div --> <!-- div -->
### <a id="_isarrayvalue"></a>`_.isArray(value)` ### <a id="_isarrayvalue"></a>`_.isArray(value)`
<a href="#_isarrayvalue">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L911 "View in source") [&#x24C9;][1] <a href="#_isarrayvalue">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L936 "View in source") [&#x24C9;][1]
Checks if `value` is an array. Checks if `value` is an array.
@@ -1163,7 +1178,7 @@ _.isArray([1, 2, 3]);
<!-- div --> <!-- div -->
### <a id="_isbooleanvalue"></a>`_.isBoolean(value)` ### <a id="_isbooleanvalue"></a>`_.isBoolean(value)`
<a href="#_isbooleanvalue">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1248 "View in source") [&#x24C9;][1] <a href="#_isbooleanvalue">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1330 "View in source") [&#x24C9;][1]
Checks if `value` is a boolean *(`true` or `false`)* value. Checks if `value` is a boolean *(`true` or `false`)* value.
@@ -1187,7 +1202,7 @@ _.isBoolean(null);
<!-- div --> <!-- div -->
### <a id="_isdatevalue"></a>`_.isDate(value)` ### <a id="_isdatevalue"></a>`_.isDate(value)`
<a href="#_isdatevalue">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1265 "View in source") [&#x24C9;][1] <a href="#_isdatevalue">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1347 "View in source") [&#x24C9;][1]
Checks if `value` is a date. Checks if `value` is a date.
@@ -1211,7 +1226,7 @@ _.isDate(new Date);
<!-- div --> <!-- div -->
### <a id="_iselementvalue"></a>`_.isElement(value)` ### <a id="_iselementvalue"></a>`_.isElement(value)`
<a href="#_iselementvalue">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1282 "View in source") [&#x24C9;][1] <a href="#_iselementvalue">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1364 "View in source") [&#x24C9;][1]
Checks if `value` is a DOM element. Checks if `value` is a DOM element.
@@ -1235,7 +1250,7 @@ _.isElement(document.body);
<!-- div --> <!-- div -->
### <a id="_isemptyvalue"></a>`_.isEmpty(value)` ### <a id="_isemptyvalue"></a>`_.isEmpty(value)`
<a href="#_isemptyvalue">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1307 "View in source") [&#x24C9;][1] <a href="#_isemptyvalue">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1389 "View in source") [&#x24C9;][1]
Checks if `value` is empty. Arrays, strings, or `arguments` objects with a length of `0` and objects with no own enumerable properties are considered "empty". Checks if `value` is empty. Arrays, strings, or `arguments` objects with a length of `0` and objects with no own enumerable properties are considered "empty".
@@ -1265,7 +1280,7 @@ _.isEmpty('');
<!-- div --> <!-- div -->
### <a id="_isequala-b--stack-thorough"></a>`_.isEqual(a, b [, stack=[]], thorough)` ### <a id="_isequala-b--stack-thorough"></a>`_.isEqual(a, b [, stack=[]], thorough)`
<a href="#_isequala-b--stack-thorough">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1349 "View in source") [&#x24C9;][1] <a href="#_isequala-b--stack-thorough">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1431 "View in source") [&#x24C9;][1]
Performs a deep comparison between two values to determine if they are equivalent to each other. If a value has an `isEqual` method it will be used to perform the comparison. Performs a deep comparison between two values to determine if they are equivalent to each other. If a value has an `isEqual` method it will be used to perform the comparison.
@@ -1298,7 +1313,7 @@ _.isEqual(moe, clone);
<!-- div --> <!-- div -->
### <a id="_isfinitevalue"></a>`_.isFinite(value)` ### <a id="_isfinitevalue"></a>`_.isFinite(value)`
<a href="#_isfinitevalue">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1522 "View in source") [&#x24C9;][1] <a href="#_isfinitevalue">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1604 "View in source") [&#x24C9;][1]
Checks if `value` is a finite number. Note: This is not the same as native `isFinite`, which will return true for booleans and other values. See http://es5.github.com/#x15.1.2.5. Checks if `value` is a finite number. Note: This is not the same as native `isFinite`, which will return true for booleans and other values. See http://es5.github.com/#x15.1.2.5.
@@ -1328,7 +1343,7 @@ _.isFinite(Infinity);
<!-- div --> <!-- div -->
### <a id="_isfunctionvalue"></a>`_.isFunction(value)` ### <a id="_isfunctionvalue"></a>`_.isFunction(value)`
<a href="#_isfunctionvalue">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L928 "View in source") [&#x24C9;][1] <a href="#_isfunctionvalue">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L953 "View in source") [&#x24C9;][1]
Checks if `value` is a function. Checks if `value` is a function.
@@ -1352,7 +1367,7 @@ _.isFunction(''.concat);
<!-- div --> <!-- div -->
### <a id="_isnanvalue"></a>`_.isNaN(value)` ### <a id="_isnanvalue"></a>`_.isNaN(value)`
<a href="#_isnanvalue">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1577 "View in source") [&#x24C9;][1] <a href="#_isnanvalue">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1659 "View in source") [&#x24C9;][1]
Checks if `value` is `NaN`. Note: This is not the same as native `isNaN`, which will return true for `undefined` and other values. See http://es5.github.com/#x15.1.2.4. Checks if `value` is `NaN`. Note: This is not the same as native `isNaN`, which will return true for `undefined` and other values. See http://es5.github.com/#x15.1.2.4.
@@ -1385,7 +1400,7 @@ _.isNaN(undefined);
<!-- div --> <!-- div -->
### <a id="_isnullvalue"></a>`_.isNull(value)` ### <a id="_isnullvalue"></a>`_.isNull(value)`
<a href="#_isnullvalue">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1600 "View in source") [&#x24C9;][1] <a href="#_isnullvalue">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1682 "View in source") [&#x24C9;][1]
Checks if `value` is `null`. Checks if `value` is `null`.
@@ -1412,7 +1427,7 @@ _.isNull(undefined);
<!-- div --> <!-- div -->
### <a id="_isnumbervalue"></a>`_.isNumber(value)` ### <a id="_isnumbervalue"></a>`_.isNumber(value)`
<a href="#_isnumbervalue">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1617 "View in source") [&#x24C9;][1] <a href="#_isnumbervalue">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1699 "View in source") [&#x24C9;][1]
Checks if `value` is a number. Checks if `value` is a number.
@@ -1436,7 +1451,7 @@ _.isNumber(8.4 * 5;
<!-- div --> <!-- div -->
### <a id="_isobjectvalue"></a>`_.isObject(value)` ### <a id="_isobjectvalue"></a>`_.isObject(value)`
<a href="#_isobjectvalue">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1543 "View in source") [&#x24C9;][1] <a href="#_isobjectvalue">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1625 "View in source") [&#x24C9;][1]
Checks if `value` is the language type of Object. *(e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)* Checks if `value` is the language type of Object. *(e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)*
@@ -1463,7 +1478,7 @@ _.isObject(1);
<!-- div --> <!-- div -->
### <a id="_isregexpvalue"></a>`_.isRegExp(value)` ### <a id="_isregexpvalue"></a>`_.isRegExp(value)`
<a href="#_isregexpvalue">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1634 "View in source") [&#x24C9;][1] <a href="#_isregexpvalue">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1716 "View in source") [&#x24C9;][1]
Checks if `value` is a regular expression. Checks if `value` is a regular expression.
@@ -1487,7 +1502,7 @@ _.isRegExp(/moe/);
<!-- div --> <!-- div -->
### <a id="_isstringvalue"></a>`_.isString(value)` ### <a id="_isstringvalue"></a>`_.isString(value)`
<a href="#_isstringvalue">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1651 "View in source") [&#x24C9;][1] <a href="#_isstringvalue">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1733 "View in source") [&#x24C9;][1]
Checks if `value` is a string. Checks if `value` is a string.
@@ -1511,7 +1526,7 @@ _.isString('moe');
<!-- div --> <!-- div -->
### <a id="_isundefinedvalue"></a>`_.isUndefined(value)` ### <a id="_isundefinedvalue"></a>`_.isUndefined(value)`
<a href="#_isundefinedvalue">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1669 "View in source") [&#x24C9;][1] <a href="#_isundefinedvalue">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1751 "View in source") [&#x24C9;][1]
Checks if `value` is `undefined`. Checks if `value` is `undefined`.
@@ -1535,7 +1550,7 @@ _.isUndefined(void 0);
<!-- div --> <!-- div -->
### <a id="_keysobject"></a>`_.keys(object)` ### <a id="_keysobject"></a>`_.keys(object)`
<a href="#_keysobject">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1686 "View in source") [&#x24C9;][1] <a href="#_keysobject">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1768 "View in source") [&#x24C9;][1]
Creates an array composed of the own enumerable property names of `object`. Creates an array composed of the own enumerable property names of `object`.
@@ -1559,7 +1574,7 @@ _.keys({ 'one': 1, 'two': 2, 'three': 3 });
<!-- div --> <!-- div -->
### <a id="_lastarray--n-guard"></a>`_.last(array [, n, guard])` ### <a id="_lastarray--n-guard"></a>`_.last(array [, n, guard])`
<a href="#_lastarray--n-guard">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2630 "View in source") [&#x24C9;][1] <a href="#_lastarray--n-guard">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2719 "View in source") [&#x24C9;][1]
Gets the last element of the `array`. Pass `n` to return the lasy `n` elementsvof the `array`. Gets the last element of the `array`. Pass `n` to return the lasy `n` elementsvof the `array`.
@@ -1585,7 +1600,7 @@ _.last([3, 2, 1]);
<!-- div --> <!-- div -->
### <a id="_lastindexofarray-value--fromindexarraylength-1"></a>`_.lastIndexOf(array, value [, fromIndex=array.length-1])` ### <a id="_lastindexofarray-value--fromindexarraylength-1"></a>`_.lastIndexOf(array, value [, fromIndex=array.length-1])`
<a href="#_lastindexofarray-value--fromindexarraylength-1">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2656 "View in source") [&#x24C9;][1] <a href="#_lastindexofarray-value--fromindexarraylength-1">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2745 "View in source") [&#x24C9;][1]
Gets the index at which the last occurrence of `value` is found using strict equality for comparisons, i.e. `===`. Gets the index at which the last occurrence of `value` is found using strict equality for comparisons, i.e. `===`.
@@ -1614,7 +1629,7 @@ _.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3);
<!-- div --> <!-- div -->
### <a id="_mapcollection--callbackidentity-thisarg"></a>`_.map(collection [, callback=identity, thisArg])` ### <a id="_mapcollection--callbackidentity-thisarg"></a>`_.map(collection [, callback=identity, thisArg])`
<a href="#_mapcollection--callbackidentity-thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2089 "View in source") [&#x24C9;][1] <a href="#_mapcollection--callbackidentity-thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2176 "View in source") [&#x24C9;][1]
Creates a new array of values by running each element in the `collection` through a `callback`. The `callback` is bound to `thisArg` and invoked with `3` arguments; *(value, index|key, collection)*. Creates a new array of values by running each element in the `collection` through a `callback`. The `callback` is bound to `thisArg` and invoked with `3` arguments; *(value, index|key, collection)*.
@@ -1643,7 +1658,7 @@ _.map({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { return num * 3; });
<!-- div --> <!-- div -->
### <a id="_maxarray--callback-thisarg"></a>`_.max(array [, callback, thisArg])` ### <a id="_maxarray--callback-thisarg"></a>`_.max(array [, callback, thisArg])`
<a href="#_maxarray--callback-thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2696 "View in source") [&#x24C9;][1] <a href="#_maxarray--callback-thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2785 "View in source") [&#x24C9;][1]
Retrieves the maximum value of an `array`. If `callback` is passed, it will be executed for each value in the `array` to generate the criterion by which the value is ranked. The `callback` is bound to `thisArg` and invoked with `3` arguments; *(value, index, array)*. Retrieves the maximum value of an `array`. If `callback` is passed, it will be executed for each value in the `array` to generate the criterion by which the value is ranked. The `callback` is bound to `thisArg` and invoked with `3` arguments; *(value, index, array)*.
@@ -1675,7 +1690,7 @@ _.max(stooges, function(stooge) { return stooge.age; });
<!-- div --> <!-- div -->
### <a id="_memoizefunc--resolver"></a>`_.memoize(func [, resolver])` ### <a id="_memoizefunc--resolver"></a>`_.memoize(func [, resolver])`
<a href="#_memoizefunc--resolver">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3434 "View in source") [&#x24C9;][1] <a href="#_memoizefunc--resolver">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3523 "View in source") [&#x24C9;][1]
Creates a new function that memoizes the result of `func`. If `resolver` is passed, it will be used to determine the cache key for storing the result based on the arguments passed to the memoized function. By default, the first argument passed to the memoized function is used as the cache key. Creates a new function that memoizes the result of `func`. If `resolver` is passed, it will be used to determine the cache key for storing the result based on the arguments passed to the memoized function. By default, the first argument passed to the memoized function is used as the cache key.
@@ -1701,7 +1716,7 @@ var fibonacci = _.memoize(function(n) {
<!-- div --> <!-- div -->
### <a id="_mergeobject--source1-source2--indicator-stack"></a>`_.merge(object [, source1, source2, ..., indicator, stack=[]])` ### <a id="_mergeobject--source1-source2--indicator-stack"></a>`_.merge(object [, source1, source2, ..., indicator, stack=[]])`
<a href="#_mergeobject--source1-source2--indicator-stack">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1728 "View in source") [&#x24C9;][1] <a href="#_mergeobject--source1-source2--indicator-stack">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1810 "View in source") [&#x24C9;][1]
Merges enumerable properties of the source object(s) into the `destination` object. Subsequent sources will overwrite propery assignments of previous sources. Merges enumerable properties of the source object(s) into the `destination` object. Subsequent sources will overwrite propery assignments of previous sources.
@@ -1738,7 +1753,7 @@ _.merge(stooges, ages);
<!-- div --> <!-- div -->
### <a id="_minarray--callback-thisarg"></a>`_.min(array [, callback, thisArg])` ### <a id="_minarray--callback-thisarg"></a>`_.min(array [, callback, thisArg])`
<a href="#_minarray--callback-thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2746 "View in source") [&#x24C9;][1] <a href="#_minarray--callback-thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2835 "View in source") [&#x24C9;][1]
Retrieves the minimum value of an `array`. If `callback` is passed, it will be executed for each value in the `array` to generate the criterion by which the value is ranked. The `callback` is bound to `thisArg` and invoked with `3` arguments; *(value, index, array)*. Retrieves the minimum value of an `array`. If `callback` is passed, it will be executed for each value in the `array` to generate the criterion by which the value is ranked. The `callback` is bound to `thisArg` and invoked with `3` arguments; *(value, index, array)*.
@@ -1764,7 +1779,7 @@ _.min([10, 5, 100, 2, 1000]);
<!-- div --> <!-- div -->
### <a id="_mixinobject"></a>`_.mixin(object)` ### <a id="_mixinobject"></a>`_.mixin(object)`
<a href="#_mixinobject">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3654 "View in source") [&#x24C9;][1] <a href="#_mixinobject">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3743 "View in source") [&#x24C9;][1]
Adds functions properties of `object` to the `lodash` function and chainable wrapper. Adds functions properties of `object` to the `lodash` function and chainable wrapper.
@@ -1794,7 +1809,7 @@ _('curly').capitalize();
<!-- div --> <!-- div -->
### <a id="_noconflict"></a>`_.noConflict()` ### <a id="_noconflict"></a>`_.noConflict()`
<a href="#_noconflict">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3685 "View in source") [&#x24C9;][1] <a href="#_noconflict">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3774 "View in source") [&#x24C9;][1]
Reverts the '_' variable to its previous value and returns a reference to the `lodash` function. Reverts the '_' variable to its previous value and returns a reference to the `lodash` function.
@@ -1814,7 +1829,7 @@ var lodash = _.noConflict();
<!-- div --> <!-- div -->
### <a id="_oncefunc"></a>`_.once(func)` ### <a id="_oncefunc"></a>`_.once(func)`
<a href="#_oncefunc">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3460 "View in source") [&#x24C9;][1] <a href="#_oncefunc">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3549 "View in source") [&#x24C9;][1]
Creates a new function that is restricted to one execution. Repeat calls to the function will return the value of the first call. Creates a new function that is restricted to one execution. Repeat calls to the function will return the value of the first call.
@@ -1840,7 +1855,7 @@ initialize();
<!-- div --> <!-- div -->
### <a id="_partialfunc--arg1-arg2-"></a>`_.partial(func [, arg1, arg2, ...])` ### <a id="_partialfunc--arg1-arg2-"></a>`_.partial(func [, arg1, arg2, ...])`
<a href="#_partialfunc--arg1-arg2-">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3495 "View in source") [&#x24C9;][1] <a href="#_partialfunc--arg1-arg2-">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3584 "View in source") [&#x24C9;][1]
Creates a new function that, when called, invokes `func` with any additional `partial` arguments prepended to those passed to the new function. This method is similar `bind`, except it does **not** alter the `this` binding. Creates a new function that, when called, invokes `func` with any additional `partial` arguments prepended to those passed to the new function. This method is similar `bind`, except it does **not** alter the `this` binding.
@@ -1866,14 +1881,15 @@ hi('moe');
<!-- div --> <!-- div -->
### <a id="_pickobject--prop1-prop2-"></a>`_.pick(object [, prop1, prop2, ...])` ### <a id="_pickobject-callback-prop1-prop2--thisarg"></a>`_.pick(object, callback|[prop1, prop2, ..., thisArg])`
<a href="#_pickobject--prop1-prop2-">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1771 "View in source") [&#x24C9;][1] <a href="#_pickobject-callback-prop1-prop2--thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1862 "View in source") [&#x24C9;][1]
Creates a shallow clone of `object` composed of the specified properties. Property names may be specified as individual arguments or as arrays of property names. Creates a shallow clone of `object` composed of the specified properties. Property names may be specified as individual arguments or as arrays of property names. If `callback` is passed, it will be executed for each property in the `object`, picking the properties `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with `3` arguments; *(value, key, object)*.
#### Arguments #### Arguments
1. `object` *(Object)*: The source object. 1. `object` *(Object)*: The source object.
2. `[prop1, prop2, ...]` *(Object)*: The properties to pick. 2. `callback|[prop1, prop2, ...]` *(Function|String)*: The properties to pick or the function called per iteration.
3. `[thisArg]` *(Mixed)*: The `this` binding for the callback.
#### Returns #### Returns
*(Object)*: Returns an object composed of the picked properties. *(Object)*: Returns an object composed of the picked properties.
@@ -1882,6 +1898,11 @@ Creates a shallow clone of `object` composed of the specified properties. Proper
```js ```js
_.pick({ 'name': 'moe', 'age': 40, 'userid': 'moe1' }, 'name', 'age'); _.pick({ 'name': 'moe', 'age': 40, 'userid': 'moe1' }, 'name', 'age');
// => { 'name': 'moe', 'age': 40 } // => { 'name': 'moe', 'age': 40 }
_.pick({ 'name': 'moe', '_hint': 'knucklehead', '_seed': '96c4eb' }, function(value, key) {
return key.charAt(0) != '_';
});
// => { 'name': 'moe' }
``` ```
* * * * * *
@@ -1892,7 +1913,7 @@ _.pick({ 'name': 'moe', 'age': 40, 'userid': 'moe1' }, 'name', 'age');
<!-- div --> <!-- div -->
### <a id="_pluckcollection-property"></a>`_.pluck(collection, property)` ### <a id="_pluckcollection-property"></a>`_.pluck(collection, property)`
<a href="#_pluckcollection-property">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2112 "View in source") [&#x24C9;][1] <a href="#_pluckcollection-property">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2199 "View in source") [&#x24C9;][1]
Retrieves the value of a specified property from all elements in the `collection`. Retrieves the value of a specified property from all elements in the `collection`.
@@ -1923,7 +1944,7 @@ _.pluck(stooges, 'name');
<!-- div --> <!-- div -->
### <a id="_rangestart0-end--step1"></a>`_.range([start=0], end [, step=1])` ### <a id="_rangestart0-end--step1"></a>`_.range([start=0], end [, step=1])`
<a href="#_rangestart0-end--step1">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2807 "View in source") [&#x24C9;][1] <a href="#_rangestart0-end--step1">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2896 "View in source") [&#x24C9;][1]
Creates an array of numbers *(positive and/or negative)* progressing from `start` up to but not including `stop`. This method is a port of Python's `range()` function. See http://docs.python.org/library/functions.html#range. Creates an array of numbers *(positive and/or negative)* progressing from `start` up to but not including `stop`. This method is a port of Python's `range()` function. See http://docs.python.org/library/functions.html#range.
@@ -1961,7 +1982,7 @@ _.range(0);
<!-- div --> <!-- div -->
### <a id="_reducecollection-callback--accumulator-thisarg"></a>`_.reduce(collection, callback [, accumulator, thisArg])` ### <a id="_reducecollection-callback--accumulator-thisarg"></a>`_.reduce(collection, callback [, accumulator, thisArg])`
<a href="#_reducecollection-callback--accumulator-thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2140 "View in source") [&#x24C9;][1] <a href="#_reducecollection-callback--accumulator-thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2227 "View in source") [&#x24C9;][1]
Boils down a `collection` to a single value. The initial state of the reduction is `accumulator` and each successive step of it should be returned by the `callback`. The `callback` is bound to `thisArg` and invoked with `4` arguments; for arrays they are *(accumulator, value, index|key, collection)*. Boils down a `collection` to a single value. The initial state of the reduction is `accumulator` and each successive step of it should be returned by the `callback`. The `callback` is bound to `thisArg` and invoked with `4` arguments; for arrays they are *(accumulator, value, index|key, collection)*.
@@ -1988,7 +2009,7 @@ var sum = _.reduce([1, 2, 3], function(memo, num) { return memo + num; });
<!-- div --> <!-- div -->
### <a id="_reducerightcollection-callback--accumulator-thisarg"></a>`_.reduceRight(collection, callback [, accumulator, thisArg])` ### <a id="_reducerightcollection-callback--accumulator-thisarg"></a>`_.reduceRight(collection, callback [, accumulator, thisArg])`
<a href="#_reducerightcollection-callback--accumulator-thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2177 "View in source") [&#x24C9;][1] <a href="#_reducerightcollection-callback--accumulator-thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2264 "View in source") [&#x24C9;][1]
The right-associative version of `_.reduce`. The right-associative version of `_.reduce`.
@@ -2016,7 +2037,7 @@ var flat = _.reduceRight(list, function(a, b) { return a.concat(b); }, []);
<!-- div --> <!-- div -->
### <a id="_rejectcollection--callbackidentity-thisarg"></a>`_.reject(collection [, callback=identity, thisArg])` ### <a id="_rejectcollection--callbackidentity-thisarg"></a>`_.reject(collection [, callback=identity, thisArg])`
<a href="#_rejectcollection--callbackidentity-thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2233 "View in source") [&#x24C9;][1] <a href="#_rejectcollection--callbackidentity-thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2320 "View in source") [&#x24C9;][1]
The opposite of `_.filter`, this method returns the values of a `collection` that `callback` does **not** return truthy for. The opposite of `_.filter`, this method returns the values of a `collection` that `callback` does **not** return truthy for.
@@ -2042,7 +2063,7 @@ var odds = _.reject([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; });
<!-- div --> <!-- div -->
### <a id="_restarray--n-guard"></a>`_.rest(array [, n, guard])` ### <a id="_restarray--n-guard"></a>`_.rest(array [, n, guard])`
<a href="#_restarray--n-guard">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2846 "View in source") [&#x24C9;][1] <a href="#_restarray--n-guard">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2935 "View in source") [&#x24C9;][1]
The opposite of `_.initial`, this method gets all but the first value of `array`. Pass `n` to exclude the first `n` values from the result. The opposite of `_.initial`, this method gets all but the first value of `array`. Pass `n` to exclude the first `n` values from the result.
@@ -2068,7 +2089,7 @@ _.rest([3, 2, 1]);
<!-- div --> <!-- div -->
### <a id="_resultobject-property"></a>`_.result(object, property)` ### <a id="_resultobject-property"></a>`_.result(object, property)`
<a href="#_resultobject-property">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3717 "View in source") [&#x24C9;][1] <a href="#_resultobject-property">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3806 "View in source") [&#x24C9;][1]
Resolves the value of `property` on `object`. If `property` is a function it will be invoked and its result returned, else the property value is returned. If `object` is falsey, then `null` is returned. Resolves the value of `property` on `object`. If `property` is a function it will be invoked and its result returned, else the property value is returned. If `object` is falsey, then `null` is returned.
@@ -2103,7 +2124,7 @@ _.result(object, 'stuff');
<!-- div --> <!-- div -->
### <a id="_shufflearray"></a>`_.shuffle(array)` ### <a id="_shufflearray"></a>`_.shuffle(array)`
<a href="#_shufflearray">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2867 "View in source") [&#x24C9;][1] <a href="#_shufflearray">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2956 "View in source") [&#x24C9;][1]
Creates a new array of shuffled `array` values, using a version of the Fisher-Yates shuffle. See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle. Creates a new array of shuffled `array` values, using a version of the Fisher-Yates shuffle. See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle.
@@ -2127,7 +2148,7 @@ _.shuffle([1, 2, 3, 4, 5, 6]);
<!-- div --> <!-- div -->
### <a id="_sizevalue"></a>`_.size(value)` ### <a id="_sizevalue"></a>`_.size(value)`
<a href="#_sizevalue">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1813 "View in source") [&#x24C9;][1] <a href="#_sizevalue">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1900 "View in source") [&#x24C9;][1]
Gets the size of `value` by returning `value.length` if `value` is an array, string, or `arguments` object. If `value` is an object, size is determined by returning the number of own enumerable properties it has. Gets the size of `value` by returning `value.length` if `value` is an array, string, or `arguments` object. If `value` is an object, size is determined by returning the number of own enumerable properties it has.
@@ -2157,7 +2178,7 @@ _.size('curly');
<!-- div --> <!-- div -->
### <a id="_somecollection--callbackidentity-thisarg"></a>`_.some(collection [, callback=identity, thisArg])` ### <a id="_somecollection--callbackidentity-thisarg"></a>`_.some(collection [, callback=identity, thisArg])`
<a href="#_somecollection--callbackidentity-thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2256 "View in source") [&#x24C9;][1] <a href="#_somecollection--callbackidentity-thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2343 "View in source") [&#x24C9;][1]
Checks if the `callback` returns a truthy value for **any** element of a `collection`. The function returns as soon as it finds passing value, and does not iterate over the entire `collection`. The `callback` is bound to `thisArg` and invoked with `3` arguments; *(value, index|key, collection)*. Checks if the `callback` returns a truthy value for **any** element of a `collection`. The function returns as soon as it finds passing value, and does not iterate over the entire `collection`. The `callback` is bound to `thisArg` and invoked with `3` arguments; *(value, index|key, collection)*.
@@ -2182,14 +2203,14 @@ _.some([null, 0, 'yes', false]);
<!-- div --> <!-- div -->
### <a id="_sortbycollection-callback--thisarg"></a>`_.sortBy(collection, callback [, thisArg])` ### <a id="_sortbycollection-callbackproperty--thisarg"></a>`_.sortBy(collection, callback|property [, thisArg])`
<a href="#_sortbycollection-callback--thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2286 "View in source") [&#x24C9;][1] <a href="#_sortbycollection-callbackproperty--thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2373 "View in source") [&#x24C9;][1]
Creates a new array, stable sorted in ascending order by the results of running each element of `collection` through a `callback`. The `callback` is bound to `thisArg` and invoked with `3` arguments; *(value, index|key, collection)*. The `callback` argument may also be the name of a property to sort by *(e.g. 'length')*. Creates a new array, stable sorted in ascending order by the results of running each element of `collection` through a `callback`. The `callback` is bound to `thisArg` and invoked with `3` arguments; *(value, index|key, collection)*. The `callback` argument may also be the name of a property to sort by *(e.g. 'length')*.
#### Arguments #### Arguments
1. `collection` *(Array|Object|String)*: The collection to iterate over. 1. `collection` *(Array|Object|String)*: The collection to iterate over.
2. `callback` *(Function|String)*: The function called per iteration or property name to sort by. 2. `callback|property` *(Function|String)*: The function called per iteration or property name to sort by.
3. `[thisArg]` *(Mixed)*: The `this` binding for the callback. 3. `[thisArg]` *(Mixed)*: The `this` binding for the callback.
#### Returns #### Returns
@@ -2215,7 +2236,7 @@ _.sortBy(['larry', 'brendan', 'moe'], 'length');
<!-- div --> <!-- div -->
### <a id="_sortedindexarray-value--callbackidentity-thisarg"></a>`_.sortedIndex(array, value [, callback=identity, thisArg])` ### <a id="_sortedindexarray-value--callbackidentity-thisarg"></a>`_.sortedIndex(array, value [, callback=identity, thisArg])`
<a href="#_sortedindexarray-value--callbackidentity-thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2919 "View in source") [&#x24C9;][1] <a href="#_sortedindexarray-value--callbackidentity-thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3008 "View in source") [&#x24C9;][1]
Uses a binary search to determine the smallest index at which the `value` should be inserted into `array` in order to maintain the sort order of the sorted `array`. If `callback` is passed, it will be executed for `value` and each element in `array` to compute their sort ranking. The `callback` is bound to `thisArg` and invoked with `1` argument; *(value)*. Uses a binary search to determine the smallest index at which the `value` should be inserted into `array` in order to maintain the sort order of the sorted `array`. If `callback` is passed, it will be executed for `value` and each element in `array` to compute their sort ranking. The `callback` is bound to `thisArg` and invoked with `1` argument; *(value)*.
@@ -2256,7 +2277,7 @@ _.sortedIndex(['twenty', 'thirty', 'fourty'], 'thirty-five', function(word) {
<!-- div --> <!-- div -->
### <a id="_tapvalue-interceptor"></a>`_.tap(value, interceptor)` ### <a id="_tapvalue-interceptor"></a>`_.tap(value, interceptor)`
<a href="#_tapvalue-interceptor">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4016 "View in source") [&#x24C9;][1] <a href="#_tapvalue-interceptor">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4123 "View in source") [&#x24C9;][1]
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, in order to perform operations on intermediate results within the chain. 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, in order to perform operations on intermediate results within the chain.
@@ -2286,7 +2307,7 @@ _.chain([1,2,3,200])
<!-- div --> <!-- div -->
### <a id="_templatetext-data-options"></a>`_.template(text, data, options)` ### <a id="_templatetext-data-options"></a>`_.template(text, data, options)`
<a href="#_templatetext-data-options">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3790 "View in source") [&#x24C9;][1] <a href="#_templatetext-data-options">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3879 "View in source") [&#x24C9;][1]
A micro-templating method that handles arbitrary delimiters, preserves whitespace, and correctly escapes quotes within interpolated code. Note: In the development build `_.template` utilizes sourceURLs for easier debugging. See http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl Note: Lo-Dash may be used in Chrome extensions by either creating a `lodash csp` build and avoiding `_.template` use, or loading Lo-Dash in a sandboxed page. See http://developer.chrome.com/trunk/extensions/sandboxingEval.html A micro-templating method that handles arbitrary delimiters, preserves whitespace, and correctly escapes quotes within interpolated code. Note: In the development build `_.template` utilizes sourceURLs for easier debugging. See http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl Note: Lo-Dash may be used in Chrome extensions by either creating a `lodash csp` build and avoiding `_.template` use, or loading Lo-Dash in a sandboxed page. See http://developer.chrome.com/trunk/extensions/sandboxingEval.html
@@ -2351,7 +2372,7 @@ fs.writeFileSync(path.join(cwd, 'jst.js'), '\
<!-- div --> <!-- div -->
### <a id="_throttlefunc-wait"></a>`_.throttle(func, wait)` ### <a id="_throttlefunc-wait"></a>`_.throttle(func, wait)`
<a href="#_throttlefunc-wait">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3531 "View in source") [&#x24C9;][1] <a href="#_throttlefunc-wait">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3620 "View in source") [&#x24C9;][1]
Creates a new function that, when executed, will only call the `func` function at most once per every `wait` milliseconds. If the throttled function is invoked more than once during the `wait` timeout, `func` will also be called on the trailing edge of the timeout. Subsequent calls to the throttled function will return the result of the last `func` call. Creates a new function that, when executed, will only call the `func` function at most once per every `wait` milliseconds. If the throttled function is invoked more than once during the `wait` timeout, `func` will also be called on the trailing edge of the timeout. Subsequent calls to the throttled function will return the result of the last `func` call.
@@ -2376,7 +2397,7 @@ jQuery(window).on('scroll', throttled);
<!-- div --> <!-- div -->
### <a id="_timesn-callback--thisarg"></a>`_.times(n, callback [, thisArg])` ### <a id="_timesn-callback--thisarg"></a>`_.times(n, callback [, thisArg])`
<a href="#_timesn-callback--thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3932 "View in source") [&#x24C9;][1] <a href="#_timesn-callback--thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4021 "View in source") [&#x24C9;][1]
Executes the `callback` function `n` times. The `callback` is bound to `thisArg` and invoked with `1` argument; *(index)*. Executes the `callback` function `n` times. The `callback` is bound to `thisArg` and invoked with `1` argument; *(index)*.
@@ -2402,7 +2423,7 @@ _.times(3, function() { this.grantWish(); }, genie);
<!-- div --> <!-- div -->
### <a id="_toarraycollection"></a>`_.toArray(collection)` ### <a id="_toarraycollection"></a>`_.toArray(collection)`
<a href="#_toarraycollection">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2323 "View in source") [&#x24C9;][1] <a href="#_toarraycollection">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2410 "View in source") [&#x24C9;][1]
Converts the `collection`, to an array. Useful for converting the `arguments` object. Converts the `collection`, to an array. Useful for converting the `arguments` object.
@@ -2423,10 +2444,34 @@ Converts the `collection`, to an array. Useful for converting the `arguments` ob
<!-- /div --> <!-- /div -->
<!-- div -->
### <a id="_unescapestring"></a>`_.unescape(string)`
<a href="#_unescapestring">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4048 "View in source") [&#x24C9;][1]
Converts the HTML entities `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#x27;` in `string` to their corresponding characters.
#### Arguments
1. `string` *(String)*: The string to unescape.
#### Returns
*(String)*: Returns the unescaped string.
#### Example
```js
_.unescape('Moe, Larry &amp; Curly');
// => "Moe, Larry & Curly"
```
* * *
<!-- /div -->
<!-- div --> <!-- div -->
### <a id="_unionarray1-array2-"></a>`_.union([array1, array2, ...])` ### <a id="_unionarray1-array2-"></a>`_.union([array1, array2, ...])`
<a href="#_unionarray1-array2-">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2960 "View in source") [&#x24C9;][1] <a href="#_unionarray1-array2-">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3049 "View in source") [&#x24C9;][1]
Computes the union of the passed-in arrays using strict equality for comparisons, i.e. `===`. Computes the union of the passed-in arrays using strict equality for comparisons, i.e. `===`.
@@ -2450,7 +2495,7 @@ _.union([1, 2, 3], [101, 2, 1, 10], [2, 1]);
<!-- div --> <!-- div -->
### <a id="_uniqarray--issortedfalse-callbackidentity-thisarg"></a>`_.uniq(array [, isSorted=false, callback=identity, thisArg])` ### <a id="_uniqarray--issortedfalse-callbackidentity-thisarg"></a>`_.uniq(array [, isSorted=false, callback=identity, thisArg])`
<a href="#_uniqarray--issortedfalse-callbackidentity-thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3004 "View in source") [&#x24C9;][1] <a href="#_uniqarray--issortedfalse-callbackidentity-thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3093 "View in source") [&#x24C9;][1]
Creates a duplicate-value-free version of the `array` using strict equality for comparisons, i.e. `===`. If the `array` is already sorted, passing `true` for `isSorted` will run a faster algorithm. If `callback` is passed, each element of `array` is passed through a callback` before uniqueness is computed. The `callback` is bound to `thisArg` and invoked with `3` arguments; *(value, index, array)*. Creates a duplicate-value-free version of the `array` using strict equality for comparisons, i.e. `===`. If the `array` is already sorted, passing `true` for `isSorted` will run a faster algorithm. If `callback` is passed, each element of `array` is passed through a callback` before uniqueness is computed. The `callback` is bound to `thisArg` and invoked with `3` arguments; *(value, index, array)*.
@@ -2486,7 +2531,7 @@ _.uniq([1, 2, 1.5, 3, 2.5], function(num) { return this.floor(num); }, Math);
<!-- div --> <!-- div -->
### <a id="_uniqueidprefix"></a>`_.uniqueId([prefix])` ### <a id="_uniqueidprefix"></a>`_.uniqueId([prefix])`
<a href="#_uniqueidprefix">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3959 "View in source") [&#x24C9;][1] <a href="#_uniqueidprefix">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4066 "View in source") [&#x24C9;][1]
Generates a unique id. If `prefix` is passed, the id will be appended to it. Generates a unique id. If `prefix` is passed, the id will be appended to it.
@@ -2510,7 +2555,7 @@ _.uniqueId('contact_');
<!-- div --> <!-- div -->
### <a id="_valuesobject"></a>`_.values(object)` ### <a id="_valuesobject"></a>`_.values(object)`
<a href="#_valuesobject">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1844 "View in source") [&#x24C9;][1] <a href="#_valuesobject">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1931 "View in source") [&#x24C9;][1]
Creates an array composed of the own enumerable property values of `object`. Creates an array composed of the own enumerable property values of `object`.
@@ -2534,7 +2579,7 @@ _.values({ 'one': 1, 'two': 2, 'three': 3 });
<!-- div --> <!-- div -->
### <a id="_wherecollection-properties"></a>`_.where(collection, properties)` ### <a id="_wherecollection-properties"></a>`_.where(collection, properties)`
<a href="#_wherecollection-properties">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2360 "View in source") [&#x24C9;][1] <a href="#_wherecollection-properties">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2447 "View in source") [&#x24C9;][1]
Examines each element in a `collection`, returning an array of all elements that contain the given `properties`. Examines each element in a `collection`, returning an array of all elements that contain the given `properties`.
@@ -2565,7 +2610,7 @@ _.where(stooges, { 'age': 40 });
<!-- div --> <!-- div -->
### <a id="_withoutarray--value1-value2-"></a>`_.without(array [, value1, value2, ...])` ### <a id="_withoutarray--value1-value2-"></a>`_.without(array [, value1, value2, ...])`
<a href="#_withoutarray--value1-value2-">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3053 "View in source") [&#x24C9;][1] <a href="#_withoutarray--value1-value2-">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3142 "View in source") [&#x24C9;][1]
Creates a new array with all occurrences of the passed values removed using strict equality for comparisons, i.e. `===`. Creates a new array with all occurrences of the passed values removed using strict equality for comparisons, i.e. `===`.
@@ -2590,7 +2635,7 @@ _.without([1, 2, 1, 0, 3, 1, 4], 0, 1);
<!-- div --> <!-- div -->
### <a id="_wrapvalue-wrapper"></a>`_.wrap(value, wrapper)` ### <a id="_wrapvalue-wrapper"></a>`_.wrap(value, wrapper)`
<a href="#_wrapvalue-wrapper">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3582 "View in source") [&#x24C9;][1] <a href="#_wrapvalue-wrapper">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3671 "View in source") [&#x24C9;][1]
Creates a new function that passes `value` to the `wrapper` function as its first argument. Additional arguments passed to the new function are appended to those passed to the `wrapper` function. Creates a new function that passes `value` to the `wrapper` function as its first argument. Additional arguments passed to the new function are appended to those passed to the `wrapper` function.
@@ -2619,7 +2664,7 @@ hello();
<!-- div --> <!-- div -->
### <a id="_ziparray1-array2-"></a>`_.zip([array1, array2, ...])` ### <a id="_ziparray1-array2-"></a>`_.zip([array1, array2, ...])`
<a href="#_ziparray1-array2-">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3086 "View in source") [&#x24C9;][1] <a href="#_ziparray1-array2-">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3175 "View in source") [&#x24C9;][1]
Groups the elements of each array at their corresponding indexes. Useful for separate data sources that are coordinated through matching array indexes. For a matrix of nested arrays, `_.zip.apply(...)` can transpose the matrix in a similar fashion. Groups the elements of each array at their corresponding indexes. Useful for separate data sources that are coordinated through matching array indexes. For a matrix of nested arrays, `_.zip.apply(...)` can transpose the matrix in a similar fashion.
@@ -2643,7 +2688,7 @@ _.zip(['moe', 'larry', 'curly'], [30, 40, 50], [true, false, false]);
<!-- div --> <!-- div -->
### <a id="_zipobjectkeys--values"></a>`_.zipObject(keys [, values=[]])` ### <a id="_zipobjectkeys--values"></a>`_.zipObject(keys [, values=[]])`
<a href="#_zipobjectkeys--values">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3115 "View in source") [&#x24C9;][1] <a href="#_zipobjectkeys--values">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3204 "View in source") [&#x24C9;][1]
Creates an object composed from an array of `keys` and an array of `values`. Creates an object composed from an array of `keys` and an array of `values`.
@@ -2675,7 +2720,7 @@ _.zipObject(['moe', 'larry', 'curly'], [30, 40, 50]);
<!-- div --> <!-- div -->
### <a id="_prototypechain"></a>`_.prototype.chain()` ### <a id="_prototypechain"></a>`_.prototype.chain()`
<a href="#_prototypechain">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4034 "View in source") [&#x24C9;][1] <a href="#_prototypechain">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4141 "View in source") [&#x24C9;][1]
Enables method chaining on the wrapper object. Enables method chaining on the wrapper object.
@@ -2696,7 +2741,7 @@ _([1, 2, 3]).value();
<!-- div --> <!-- div -->
### <a id="_prototypevalue"></a>`_.prototype.value()` ### <a id="_prototypevalue"></a>`_.prototype.value()`
<a href="#_prototypevalue">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4051 "View in source") [&#x24C9;][1] <a href="#_prototypevalue">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4158 "View in source") [&#x24C9;][1]
Extracts the wrapped value. Extracts the wrapped value.
@@ -2724,7 +2769,7 @@ _([1, 2, 3]).value();
<!-- div --> <!-- div -->
### <a id="_templatesettings"></a>`_.templateSettings` ### <a id="_templatesettings"></a>`_.templateSettings`
<a href="#_templatesettings">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L278 "View in source") [&#x24C9;][1] <a href="#_templatesettings">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L321 "View in source") [&#x24C9;][1]
*(Object)*: By default, the template delimiters used by Lo-Dash are similar to those in embedded Ruby *(ERB)*. Change the following template settings to use alternative delimiters. *(Object)*: By default, the template delimiters used by Lo-Dash are similar to those in embedded Ruby *(ERB)*. Change the following template settings to use alternative delimiters.
@@ -2736,7 +2781,7 @@ _([1, 2, 3]).value();
<!-- div --> <!-- div -->
### <a id="_templatesettingsescape"></a>`_.templateSettings.escape` ### <a id="_templatesettingsescape"></a>`_.templateSettings.escape`
<a href="#_templatesettingsescape">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L287 "View in source") [&#x24C9;][1] <a href="#_templatesettingsescape">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L330 "View in source") [&#x24C9;][1]
*(RegExp)*: Used to detect `data` property values to be HTML-escaped. *(RegExp)*: Used to detect `data` property values to be HTML-escaped.
@@ -2748,7 +2793,7 @@ _([1, 2, 3]).value();
<!-- div --> <!-- div -->
### <a id="_templatesettingsevaluate"></a>`_.templateSettings.evaluate` ### <a id="_templatesettingsevaluate"></a>`_.templateSettings.evaluate`
<a href="#_templatesettingsevaluate">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L296 "View in source") [&#x24C9;][1] <a href="#_templatesettingsevaluate">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L339 "View in source") [&#x24C9;][1]
*(RegExp)*: Used to detect code to be evaluated. *(RegExp)*: Used to detect code to be evaluated.
@@ -2760,7 +2805,7 @@ _([1, 2, 3]).value();
<!-- div --> <!-- div -->
### <a id="_templatesettingsinterpolate"></a>`_.templateSettings.interpolate` ### <a id="_templatesettingsinterpolate"></a>`_.templateSettings.interpolate`
<a href="#_templatesettingsinterpolate">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L305 "View in source") [&#x24C9;][1] <a href="#_templatesettingsinterpolate">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L348 "View in source") [&#x24C9;][1]
*(RegExp)*: Used to detect `data` property values to inject. *(RegExp)*: Used to detect `data` property values to inject.
@@ -2772,7 +2817,7 @@ _([1, 2, 3]).value();
<!-- div --> <!-- div -->
### <a id="_templatesettingsvariable"></a>`_.templateSettings.variable` ### <a id="_templatesettingsvariable"></a>`_.templateSettings.variable`
<a href="#_templatesettingsvariable">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L314 "View in source") [&#x24C9;][1] <a href="#_templatesettingsvariable">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L357 "View in source") [&#x24C9;][1]
*(String)*: Used to reference the data object in the template text. *(String)*: Used to reference the data object in the template text.
@@ -2784,6 +2829,25 @@ _([1, 2, 3]).value();
<!-- /div --> <!-- /div -->
<!-- div -->
## ``
<!-- div -->
### <a id=""></a>``
<a href="#">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L218 "View in source") [&#x24C9;][1]
(Unknown): Detect if sourceURL syntax is usable without erroring: The JS engine in Adobe products, like InDesign, will throw a syntax error when it encounters a single line comment beginning with the `@` symbol. The JS engine in Narwhal will generate the function `function anonymous(){//}` and throw a syntax error. Avoid comments beginning `@` symbols in IE because they are part of its non-standard conditional compilation support. http://msdn.microsoft.com/en-us/library/121hztk3(v=vs.94).aspx
* * *
<!-- /div -->
<!-- /div -->
<!-- /div --> <!-- /div -->

View File

@@ -21,7 +21,7 @@
// generate Markdown // generate Markdown
$markdown = docdown(array( $markdown = docdown(array(
'path' => '../' . $file, 'path' => '../' . $file,
'title' => 'Lo-Dash <sup>v0.5.2</sup>', 'title' => 'Lo-Dash <sup>v0.6.1</sup>',
'url' => 'https://github.com/bestiejs/lodash/blob/master/lodash.js' 'url' => 'https://github.com/bestiejs/lodash/blob/master/lodash.js'
)); ));

401
lodash.js
View File

@@ -1,5 +1,5 @@
/*! /*!
* Lo-Dash v0.5.2 <http://lodash.com> * Lo-Dash v0.6.1 <http://lodash.com>
* Copyright 2012 John-David Dalton <http://allyoucanleet.com/> * Copyright 2012 John-David Dalton <http://allyoucanleet.com/>
* Based on Underscore.js 1.3.3, copyright 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. * Based on Underscore.js 1.3.3, copyright 2009-2012 Jeremy Ashkenas, DocumentCloud Inc.
* <http://documentcloud.github.com/underscore> * <http://documentcloud.github.com/underscore>
@@ -47,12 +47,18 @@
/** Used to generate unique IDs */ /** Used to generate unique IDs */
var idCounter = 0; var idCounter = 0;
/** Used by `cachedContains` as the default size when optimizations are enabled for large arrays */
var largeArraySize = 30;
/** Used to restore the original `_` reference in `noConflict` */ /** Used to restore the original `_` reference in `noConflict` */
var oldDash = window._; var oldDash = window._;
/** Used to detect delimiter values that should be processed by `tokenizeEvaluate` */ /** Used to detect delimiter values that should be processed by `tokenizeEvaluate` */
var reComplexDelimiter = /[-+=!~*%&^<>|{(\/]|\[\D|\b(?:delete|in|instanceof|new|typeof|void)\b/; var reComplexDelimiter = /[-+=!~*%&^<>|{(\/]|\[\D|\b(?:delete|in|instanceof|new|typeof|void)\b/;
/** Used to match HTML entities */
var reEscapedHtml = /&(?:amp|lt|gt|quot|#x27);/g;
/** 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,
@@ -71,11 +77,11 @@
.replace(/valueOf|for [^\]]+/g, '.+?') + '$' .replace(/valueOf|for [^\]]+/g, '.+?') + '$'
); );
/** Used to match tokens in template text */ /** Used to match internally used tokens in template text */
var reToken = /__token__(\d+)/g; var reToken = /__token__(\d+)/g;
/** Used to match unescaped characters in strings for inclusion in HTML */ /** Used to match HTML characters */
var reUnescapedHtml = /[&<"']/g; var reUnescapedHtml = /[&<>"']/g;
/** Used to match unescaped characters in compiled string literals */ /** Used to match unescaped characters in compiled string literals */
var reUnescapedString = /['\n\r\t\u2028\u2029\\]/g; var reUnescapedString = /['\n\r\t\u2028\u2029\\]/g;
@@ -126,11 +132,24 @@
/** /**
* Detect the JScript [[DontEnum]] bug: * Detect the JScript [[DontEnum]] bug:
*
* In IE < 9 an objects own properties, shadowing non-enumerable ones, are * In IE < 9 an objects own properties, shadowing non-enumerable ones, are
* made non-enumerable as well. * made non-enumerable as well.
*/ */
var hasDontEnumBug; var hasDontEnumBug;
/**
* Detect if `Array#shift` and `Array#splice` augment array-like objects
* incorrectly:
*
* Firefox < 10, IE compatibility mode, and IE < 9 have buggy Array `shift()`
* and `splice()` functions that fail to remove the last element, `value[0]`,
* of array-like objects even though the `length` property is set to `0`.
* The `shift()` method is buggy in IE 8 compatibility mode, while `splice()`
* is buggy regardless of mode in IE < 9 and buggy in compatibility mode in IE 9.
*/
var hasObjectSpliceBug;
/** Detect if own properties are iterated after inherited properties (IE < 9) */ /** Detect if own properties are iterated after inherited properties (IE < 9) */
var iteratesOwnLast; var iteratesOwnLast;
@@ -138,13 +157,17 @@
var noArgsEnum = true; var noArgsEnum = true;
(function() { (function() {
var props = []; var object = { '0': 1, 'length': 1 },
props = [];
function ctor() { this.x = 1; } function ctor() { this.x = 1; }
ctor.prototype = { 'valueOf': 1, 'y': 1 }; ctor.prototype = { 'valueOf': 1, 'y': 1 };
for (var prop in new ctor) { props.push(prop); } for (var prop in new ctor) { props.push(prop); }
for (prop in arguments) { noArgsEnum = !prop; } for (prop in arguments) { noArgsEnum = !prop; }
hasDontEnumBug = (props + '').length < 4; hasDontEnumBug = (props + '').length < 4;
iteratesOwnLast = props[0] != 'x'; iteratesOwnLast = props[0] != 'x';
hasObjectSpliceBug = (props.splice.call(object, 0, 1), object[0]);
}(1)); }(1));
/** Detect if an `arguments` object's [[Class]] is unresolvable (Firefox < 4, IE < 9) */ /** Detect if an `arguments` object's [[Class]] is unresolvable (Firefox < 4, IE < 9) */
@@ -155,6 +178,7 @@
/** /**
* Detect lack of support for accessing string characters by index: * Detect lack of support for accessing string characters by index:
*
* IE < 8 can't access characters by index and IE 8 can only access * IE < 8 can't access characters by index and IE 8 can only access
* characters by index on string literals. * characters by index on string literals.
*/ */
@@ -175,17 +199,24 @@
/* Detect if `Object.keys` exists and is inferred to be fast (IE, Opera, V8) */ /* Detect if `Object.keys` exists and is inferred to be fast (IE, Opera, V8) */
var isKeysFast = nativeKeys && /^.+$|true/.test(nativeKeys + !!window.attachEvent); var isKeysFast = nativeKeys && /^.+$|true/.test(nativeKeys + !!window.attachEvent);
/** Detect if sourceURL syntax is usable without erroring */ /* Detect if strict mode, "use strict", is inferred to be fast (V8) */
var isStrictFast = !isBindFast;
/**
* Detect if sourceURL syntax is usable without erroring:
*
* The JS engine in Adobe products, like InDesign, will throw a syntax error
* when it encounters a single line comment beginning with the `@` symbol.
*
* The JS engine in Narwhal will generate the function `function anonymous(){//}`
* and throw a syntax error.
*
* Avoid comments beginning `@` symbols in IE because they are part of its
* non-standard conditional compilation support.
* http://msdn.microsoft.com/en-us/library/121hztk3(v=vs.94).aspx
*/
try { try {
// The JS engine in Adobe products, like InDesign, will throw a syntax error var useSourceURL = (Function('//@')(), !window.attachEvent);
// when it encounters a single line comment beginning with the `@` symbol.
// The JS engine in Narwhal will generate the function `function anonymous(){//}`
// and throw a syntax error. In IE, `@` symbols are part of its non-standard
// conditional compilation support. The `@cc_on` statement activates its support
// while the trailing ` !` induces a syntax error to exlude it. Compatibility
// modes in IE > 8 require a space before the `!` to induce a syntax error.
// See http://msdn.microsoft.com/en-us/library/121hztk3(v=vs.94).aspx
var useSourceURL = (Function('//@cc_on !')(), true);
} catch(e){ } } catch(e){ }
/** Used to identify object classifications that are array-like */ /** Used to identify object classifications that are array-like */
@@ -202,18 +233,30 @@
cloneableClasses[stringClass] = true; cloneableClasses[stringClass] = true;
/** /**
* Used to escape characters for inclusion in HTML. * Used to convert characters to HTML entities:
* The `>` and `/` characters don't require escaping in HTML and have no *
* special meaning unless they're part of a tag or an unquoted attribute value * Though the `>` character is escaped for symmetry, characters like `>` and `/`
* http://mathiasbynens.be/notes/ambiguous-ampersands (semi-related fun fact) * don't require escaping in HTML and have no special meaning unless they're part
* of a tag or an unquoted attribute value.
* http://mathiasbynens.be/notes/ambiguous-ampersands (under "semi-related fun fact")
*/ */
var htmlEscapes = { var htmlEscapes = {
'&': '&amp;', '&': '&amp;',
'<': '&lt;', '<': '&lt;',
'>': '&gt;',
'"': '&quot;', '"': '&quot;',
"'": '&#x27;' "'": '&#x27;'
}; };
/** Used to convert HTML entities to characters */
var htmlUnescapes = {
'&amp;': '&',
'&lt;': '<',
'&gt;': '>',
'&quot;': '"',
'&#x27;': "'"
};
/** 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 = {
'boolean': false, 'boolean': false,
@@ -371,6 +414,12 @@
' } else {' + ' } else {' +
' <% } %>' + ' <% } %>' +
// Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1
// (if the prototype or a property on the prototype has been set)
// incorrectly sets a function's `prototype` property [[Enumerable]]
// value to `true`. Because of this Lo-Dash standardizes on skipping
// the the `prototype` property of functions regardless of its
// [[Enumerable]] value.
' <% if (!hasDontEnumBug) { %>\n' + ' <% if (!hasDontEnumBug) { %>\n' +
' var skipProto = typeof iteratee == \'function\' && \n' + ' var skipProto = typeof iteratee == \'function\' && \n' +
' propertyIsEnumerable.call(iteratee, \'prototype\');\n' + ' propertyIsEnumerable.call(iteratee, \'prototype\');\n' +
@@ -394,25 +443,15 @@
' <% } else { %>\n' + ' <% } else { %>\n' +
' <%= objectBranch.beforeLoop %>;\n' + ' <%= objectBranch.beforeLoop %>;\n' +
' for (index in iteratee) {' + ' for (index in iteratee) {' +
' <% if (hasDontEnumBug) { %>\n' + ' <% if (!hasDontEnumBug || useHas) { %>\n if (<%' +
' <% if (useHas) { %>if (hasOwnProperty.call(iteratee, index)) {\n <% } %>' + ' if (!hasDontEnumBug) { %>!(skipProto && index == \'prototype\')<% }' +
' if (!hasDontEnumBug && useHas) { %> && <% }' +
' if (useHas) { %>hasOwnProperty.call(iteratee, index)<% }' +
' %>) {' +
' <% } %>\n' +
' value = iteratee[index];\n' + ' value = iteratee[index];\n' +
' <%= objectBranch.inLoop %>;\n' + ' <%= objectBranch.inLoop %>;\n' +
' <% if (useHas) { %>}<% } %>' + ' <% if (!hasDontEnumBug || useHas) { %>}\n<% } %>' +
// Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1
// (if the prototype or a property on the prototype has been set)
// incorrectly sets a function's `prototype` property [[Enumerable]]
// value to `true`. Because of this Lo-Dash standardizes on skipping
// the the `prototype` property of functions regardless of its
// [[Enumerable]] value.
' <% } else { %>\n' +
' if (!(skipProto && index == \'prototype\')<% if (useHas) { %> &&\n' +
' hasOwnProperty.call(iteratee, index)<% } %>) {\n' +
' value = iteratee[index];\n' +
' <%= objectBranch.inLoop %>\n' +
' }' +
' <% } %>\n' +
' }' + ' }' +
' <% } %>' + ' <% } %>' +
@@ -477,6 +516,25 @@
'(hasOwnProperty.call(result, prop) ? result[prop]++ : result[prop] = 1)' '(hasOwnProperty.call(result, prop) ? result[prop]++ : result[prop] = 1)'
}; };
/** Reusable iterator options for `drop` and `pick` */
var dropIteratorOptions = {
'useHas': false,
'args': 'object, callback, thisArg',
'init': '{}',
'top':
'var isFunc = typeof callback == \'function\';\n' +
'if (!isFunc) {\n' +
' var props = concat.apply(ArrayProto, arguments)\n' +
'} else if (thisArg) {\n' +
' callback = iteratorBind(callback, thisArg)\n' +
'}',
'inLoop':
'if (isFunc\n' +
' ? !callback(value, index, object)\n' +
' : indexOf(props, index) < 0\n' +
') result[index] = value'
};
/** Reusable iterator options for `every` and `some` */ /** Reusable iterator options for `every` and `some` */
var everyIteratorOptions = { var everyIteratorOptions = {
'init': 'true', 'init': 'true',
@@ -545,7 +603,7 @@
fromIndex || (fromIndex = 0); fromIndex || (fromIndex = 0);
var length = array.length, var length = array.length,
isLarge = (length - fromIndex) >= (largeSize || 30), isLarge = (length - fromIndex) >= (largeSize || largeArraySize),
cache = isLarge ? {} : array; cache = isLarge ? {} : array;
if (isLarge) { if (isLarge) {
@@ -631,8 +689,8 @@
if (typeof value == 'string') { if (typeof value == 'string') {
value = { 'array': value, 'object': value }; value = { 'array': value, 'object': value };
} }
data.arrayBranch[prop] = value.array; data.arrayBranch[prop] = value.array || '';
data.objectBranch[prop] = value.object; data.objectBranch[prop] = value.object || '';
} else { } else {
data[prop] = value; data[prop] = value;
} }
@@ -640,7 +698,8 @@
} }
// set additional template `data` values // set additional template `data` values
var args = data.args, var args = data.args,
firstArg = /^[^,]+/.exec(args)[0]; firstArg = /^[^,]+/.exec(args)[0],
useStrict = data.useStrict;
data.firstArg = firstArg; data.firstArg = firstArg;
data.hasDontEnumBug = hasDontEnumBug; data.hasDontEnumBug = hasDontEnumBug;
@@ -648,9 +707,9 @@
data.noArgsEnum = noArgsEnum; data.noArgsEnum = noArgsEnum;
data.shadowed = shadowed; data.shadowed = shadowed;
data.useHas = data.useHas !== false; data.useHas = data.useHas !== false;
data.useStrict = data.useStrict !== false; data.useStrict = useStrict == null ? isStrictFast : useStrict;
if (!('noCharByIndex' in data)) { if (data.noCharByIndex == null) {
data.noCharByIndex = noCharByIndex; data.noCharByIndex = noCharByIndex;
} }
if (!data.exit) { if (!data.exit) {
@@ -729,7 +788,7 @@
} }
/** /**
* Used by `escape` to escape characters for inclusion in HTML. * Used by `escape` to convert characters to HTML entities.
* *
* @private * @private
* @param {String} match The matched character to escape. * @param {String} match The matched character to escape.
@@ -739,51 +798,6 @@
return htmlEscapes[match]; return htmlEscapes[match];
} }
/**
* Checks if a given `value` is an object created by the `Object` constructor
* assuming objects created by the `Object` constructor have no inherited
* enumerable properties and that there are no `Object.prototype` extensions.
*
* @private
* @param {Mixed} value The value to check.
* @param {Boolean} [skipArgsCheck=false] Internally used to skip checks for
* `arguments` objects.
* @returns {Boolean} Returns `true` if the `value` is a plain `Object` object,
* else `false`.
*/
function isPlainObject(value, skipArgsCheck) {
// avoid non-objects and false positives for `arguments` objects
var result = false;
if (!(value && typeof value == 'object') || (!skipArgsCheck && isArguments(value))) {
return result;
}
// IE < 9 presents DOM nodes as `Object` objects except they have `toString`
// methods that are `typeof` "string" and still can coerce nodes to strings.
// Also check that the constructor is `Object` (i.e. `Object instanceof Object`)
var ctor = value.constructor;
if ((!noNodeClass || !(typeof value.toString != 'function' && typeof (value + '') == 'string')) &&
(!isFunction(ctor) || ctor instanceof ctor)) {
// IE < 9 iterates inherited properties before own properties. If the first
// iterated property is an object's own property then there are no inherited
// enumerable properties.
if (iteratesOwnLast) {
forIn(value, function(objValue, objKey) {
result = !hasOwnProperty.call(value, objKey);
return false;
});
return result === false;
}
// In most environments an object's own properties are iterated before
// its inherited properties. If the last iterated property is an object's
// own property then there are no inherited enumerable properties.
forIn(value, function(objValue, objKey) {
result = objKey;
});
return result === false || hasOwnProperty.call(value, result);
}
return result;
}
/** /**
* Creates a new function that, when called, invokes `func` with the `this` * Creates a new function that, when called, invokes `func` with the `this`
* binding of `thisArg` and the arguments (value, index, object). * binding of `thisArg` and the arguments (value, index, object).
@@ -864,6 +878,17 @@
return token + index; return token + index;
} }
/**
* Used by `unescape` to convert HTML entities to characters.
*
* @private
* @param {String} match The matched character to unescape.
* @returns {String} Returns the unescaped character.
*/
function unescapeHtmlChar(match) {
return htmlUnescapes[match];
}
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
/** /**
@@ -935,6 +960,59 @@
}; };
} }
/**
* Checks if a given `value` is an object created by the `Object` constructor
* assuming objects created by the `Object` constructor have no inherited
* enumerable properties and that there are no `Object.prototype` extensions.
*
* @private
* @param {Mixed} value The value to check.
* @param {Boolean} [skipArgsCheck=false] Internally used to skip checks for
* `arguments` objects.
* @returns {Boolean} Returns `true` if the `value` is a plain `Object` object,
* else `false`.
*/
function isPlainObject(value, skipArgsCheck) {
return value
? value == ObjectProto || (value.__proto__ == ObjectProto && (skipArgsCheck || !isArguments(value)))
: false;
}
// fallback for IE
if (!isPlainObject(objectTypes)) {
isPlainObject = function(value, skipArgsCheck) {
// avoid non-objects and false positives for `arguments` objects
var result = false;
if (!(value && typeof value == 'object') || (!skipArgsCheck && isArguments(value))) {
return result;
}
// IE < 9 presents DOM nodes as `Object` objects except they have `toString`
// methods that are `typeof` "string" and still can coerce nodes to strings.
// Also check that the constructor is `Object` (i.e. `Object instanceof Object`)
var ctor = value.constructor;
if ((!noNodeClass || !(typeof value.toString != 'function' && typeof (value + '') == 'string')) &&
(!isFunction(ctor) || ctor instanceof ctor)) {
// IE < 9 iterates inherited properties before own properties. If the first
// iterated property is an object's own property then there are no inherited
// enumerable properties.
if (iteratesOwnLast) {
forIn(value, function(objValue, objKey) {
result = !hasOwnProperty.call(value, objKey);
return false;
});
return result === false;
}
// In most environments an object's own properties are iterated before
// its inherited properties. If the last iterated property is an object's
// own property then there are no inherited enumerable properties.
forIn(value, function(objValue, objKey) {
result = objKey;
});
return result === false || hasOwnProperty.call(value, result);
}
return result;
};
}
/** /**
* A shim implementation of `Object.keys` that produces an array of the given * A shim implementation of `Object.keys` that produces an array of the given
* object's own enumerable property names. * object's own enumerable property names.
@@ -1097,26 +1175,30 @@
/** /**
* Creates a shallow clone of `object` excluding the specified properties. * Creates a shallow clone of `object` excluding the specified properties.
* Property names may be specified as individual arguments or as arrays of * Property names may be specified as individual arguments or as arrays of
* property names. * property names. If `callback` is passed, it will be executed for each property
* in the `object`, dropping the properties `callback` returns truthy for. The
* `callback` is bound to `thisArg` and invoked with 3 arguments; (value, key, object).
* *
* @static * @static
* @memberOf _ * @memberOf _
* @alias omit
* @category Objects * @category Objects
* @param {Object} object The source object. * @param {Object} object The source object.
* @param {Object} [prop1, prop2, ...] The properties to drop. * @param {Function|String} callback|[prop1, prop2, ...] The properties to drop
* or the function called per iteration.
* @param {Mixed} [thisArg] The `this` binding for the callback.
* @returns {Object} Returns an object without the dropped properties. * @returns {Object} Returns an object without the dropped properties.
* @example * @example
* *
* _.drop({ 'name': 'moe', 'age': 40, 'userid': 'moe1' }, 'userid'); * _.drop({ 'name': 'moe', 'age': 40, 'userid': 'moe1' }, 'userid');
* // => { 'name': 'moe', 'age': 40 } * // => { 'name': 'moe', 'age': 40 }
*
* _.drop({ 'name': 'moe', '_hint': 'knucklehead', '_seed': '96c4eb' }, function(value, key) {
* return key.charAt(0) == '_';
* });
* // => { 'name': 'moe' }
*/ */
var drop = createIterator({ var drop = createIterator(dropIteratorOptions);
'useHas': false,
'args': 'object',
'init': '{}',
'top': 'var props = concat.apply(ArrayProto, arguments)',
'inLoop': 'if (indexOf(props, index) < 0) result[index] = value'
});
/** /**
* Assigns enumerable properties of the source object(s) to the `destination` * Assigns enumerable properties of the source object(s) to the `destination`
@@ -1755,45 +1837,50 @@
/** /**
* Creates a shallow clone of `object` composed of the specified properties. * Creates a shallow clone of `object` composed of the specified properties.
* Property names may be specified as individual arguments or as arrays of * Property names may be specified as individual arguments or as arrays of
* property names. * property names. If `callback` is passed, it will be executed for each property
* in the `object`, picking the properties `callback` returns truthy for. The
* `callback` is bound to `thisArg` and invoked with 3 arguments; (value, key, object).
* *
* @static * @static
* @memberOf _ * @memberOf _
* @category Objects * @category Objects
* @param {Object} object The source object. * @param {Object} object The source object.
* @param {Object} [prop1, prop2, ...] The properties to pick. * @param {Function|String} callback|[prop1, prop2, ...] The properties to pick
* or the function called per iteration.
* @param {Mixed} [thisArg] The `this` binding for the callback.
* @returns {Object} Returns an object composed of the picked properties. * @returns {Object} Returns an object composed of the picked properties.
* @example * @example
* *
* _.pick({ 'name': 'moe', 'age': 40, 'userid': 'moe1' }, 'name', 'age'); * _.pick({ 'name': 'moe', 'age': 40, 'userid': 'moe1' }, 'name', 'age');
* // => { 'name': 'moe', 'age': 40 } * // => { 'name': 'moe', 'age': 40 }
*
* _.pick({ 'name': 'moe', '_hint': 'knucklehead', '_seed': '96c4eb' }, function(value, key) {
* return key.charAt(0) != '_';
* });
* // => { 'name': 'moe' }
*/ */
function pick(object) { var pick = createIterator(dropIteratorOptions, {
var result = {}; 'top':
if (!object) { 'if (typeof callback != \'function\') {\n' +
return result; ' var prop,\n' +
} ' props = concat.apply(ArrayProto, arguments),\n' +
var prop, ' length = props.length;\n' +
index = 0, ' for (index = 1; index < length; index++) {\n' +
props = concat.apply(ArrayProto, arguments), ' prop = props[index];\n' +
length = props.length; ' if (prop in object) result[prop] = object[prop]\n' +
' }\n' +
// start `index` at `1` to skip `object` '} else {\n' +
while (++index < length) { ' if (thisArg) callback = iteratorBind(callback, thisArg)',
prop = props[index]; 'inLoop':
if (prop in object) { 'if (callback(value, index, object)) result[index] = value',
result[prop] = object[prop]; 'bottom': '}'
} });
}
return result;
}
/** /**
* Gets the size of `value` by returning `value.length` if `value` is an * Gets the size of `value` by returning `value.length` if `value` is an
* array, string, or `arguments` object. If `value` is an object, size is * array, string, or `arguments` object. If `value` is an object, size is
* determined by returning the number of own enumerable properties it has. * determined by returning the number of own enumerable properties it has.
* *
* @deprecated
* @static * @static
* @memberOf _ * @memberOf _
* @category Objects * @category Objects
@@ -1876,7 +1963,7 @@
'init': 'false', 'init': 'false',
'noCharByIndex': false, 'noCharByIndex': false,
'beforeLoop': { 'beforeLoop': {
'array': 'if (toString.call(iteratee) == stringClass) return collection.indexOf(target) > -1' 'array': 'if (toString.call(collection) == stringClass) return collection.indexOf(target) > -1'
}, },
'inLoop': 'if (value === target) return true' 'inLoop': 'if (value === target) return true'
}); });
@@ -1892,8 +1979,8 @@
* @memberOf _ * @memberOf _
* @category Collections * @category Collections
* @param {Array|Object|String} collection The collection to iterate over. * @param {Array|Object|String} collection The collection to iterate over.
* @param {Function|String} callback The function called per iteration or * @param {Function|String} callback|property The function called per iteration
* property name to count by. * or property name to count by.
* @param {Mixed} [thisArg] The `this` binding for the callback. * @param {Mixed} [thisArg] The `this` binding for the callback.
* @returns {Object} Returns the composed aggregate object. * @returns {Object} Returns the composed aggregate object.
* @example * @example
@@ -2008,8 +2095,8 @@
* @memberOf _ * @memberOf _
* @category Collections * @category Collections
* @param {Array|Object|String} collection The collection to iterate over. * @param {Array|Object|String} collection The collection to iterate over.
* @param {Function|String} callback The function called per iteration or * @param {Function|String} callback|property The function called per iteration
* property name to group by. * or property name to group by.
* @param {Mixed} [thisArg] The `this` binding for the callback. * @param {Mixed} [thisArg] The `this` binding for the callback.
* @returns {Object} Returns the composed aggregate object. * @returns {Object} Returns the composed aggregate object.
* @example * @example
@@ -2144,7 +2231,7 @@
'var noaccum = arguments.length < 3;\n' + 'var noaccum = arguments.length < 3;\n' +
'if (thisArg) callback = iteratorBind(callback, thisArg)', 'if (thisArg) callback = iteratorBind(callback, thisArg)',
'beforeLoop': { 'beforeLoop': {
'array': 'if (noaccum) result = collection[++index]' 'array': 'if (noaccum) result = iteratee[++index]'
}, },
'inLoop': { 'inLoop': {
'array': 'array':
@@ -2268,8 +2355,8 @@
* @memberOf _ * @memberOf _
* @category Collections * @category Collections
* @param {Array|Object|String} collection The collection to iterate over. * @param {Array|Object|String} collection The collection to iterate over.
* @param {Function|String} callback The function called per iteration or * @param {Function|String} callback|property The function called per iteration
* property name to sort by. * or property name to sort by.
* @param {Mixed} [thisArg] The `this` binding for the callback. * @param {Mixed} [thisArg] The `this` binding for the callback.
* @returns {Array} Returns a new array of sorted elements. * @returns {Array} Returns a new array of sorted elements.
* @example * @example
@@ -2360,15 +2447,15 @@
var where = createIterator(filterIteratorOptions, { var where = createIterator(filterIteratorOptions, {
'args': 'collection, properties', 'args': 'collection, properties',
'top': 'top':
'var pass, prop, propIndex, props = [];\n' + 'var props = [];\n' +
'forIn(properties, function(value, prop) { props.push(prop) });\n' + 'forIn(properties, function(value, prop) { props.push(prop) });\n' +
'var propsLength = props.length', 'var propsLength = props.length',
'inLoop': 'inLoop':
'for (pass = true, propIndex = 0; propIndex < propsLength; propIndex++) {\n' + 'for (var prop, pass = true, propIndex = 0; propIndex < propsLength; propIndex++) {\n' +
' prop = props[propIndex];\n' + ' prop = props[propIndex];\n' +
' if (!(pass = value[prop] === properties[prop])) break\n' + ' if (!(pass = value[prop] === properties[prop])) break\n' +
'}\n' + '}\n' +
'if (pass) result.push(value)' 'pass && result.push(value)'
}); });
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
@@ -2592,17 +2679,19 @@
return result; return result;
} }
var value, var value,
argsLength = arguments.length,
cache = [],
index = -1, index = -1,
length = array.length, length = array.length;
others = slice.call(arguments, 1),
cache = [];
while (++index < length) { array: while (++index < length) {
value = array[index]; value = array[index];
if (indexOf(result, value) < 0 && if (indexOf(result, value) < 0) {
every(others, function(other, index) { for (var argsIndex = 1; argsIndex < argsLength; argsIndex++) {
return (cache[index] || (cache[index] = cachedContains(other)))(value); if (!(cache[argsIndex] || (cache[argsIndex] = cachedContains(arguments[argsIndex])))(value)) {
})) { continue array;
}
}
result.push(value); result.push(value);
} }
} }
@@ -3592,8 +3681,8 @@
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
/** /**
* Escapes a string for inclusion in HTML, replacing `&`, `<`, `"`, and `'` * Converts the characters `&`, `<`, `>`, `"`, and `'` in `string` to their
* characters. * corresponding HTML entities.
* *
* @static * @static
* @memberOf _ * @memberOf _
@@ -3942,6 +4031,24 @@
} }
} }
/**
* Converts the HTML entities `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#x27;`
* in `string` to their corresponding characters.
*
* @static
* @memberOf _
* @category Utilities
* @param {String} string The string to unescape.
* @returns {String} Returns the unescaped string.
* @example
*
* _.unescape('Moe, Larry &amp; Curly');
* // => "Moe, Larry & Curly"
*/
function unescape(string) {
return string == null ? '' : (string + '').replace(reEscapedHtml, unescapeHtmlChar);
}
/** /**
* Generates a unique id. If `prefix` is passed, the id will be appended to it. * Generates a unique id. If `prefix` is passed, the id will be appended to it.
* *
@@ -4061,7 +4168,7 @@
* @memberOf _ * @memberOf _
* @type String * @type String
*/ */
lodash.VERSION = '0.5.2'; lodash.VERSION = '0.6.1';
// assign static methods // assign static methods
lodash.after = after; lodash.after = after;
@@ -4143,6 +4250,7 @@
lodash.throttle = throttle; lodash.throttle = throttle;
lodash.times = times; lodash.times = times;
lodash.toArray = toArray; lodash.toArray = toArray;
lodash.unescape = unescape;
lodash.union = union; lodash.union = union;
lodash.uniq = uniq; lodash.uniq = uniq;
lodash.uniqueId = uniqueId; lodash.uniqueId = uniqueId;
@@ -4165,6 +4273,7 @@
lodash.include = contains; lodash.include = contains;
lodash.inject = reduce; lodash.inject = reduce;
lodash.methods = functions; lodash.methods = functions;
lodash.omit = drop;
lodash.select = filter; lodash.select = filter;
lodash.tail = rest; lodash.tail = rest;
lodash.take = first; lodash.take = first;
@@ -4195,13 +4304,9 @@
var value = this._wrapped; var value = this._wrapped;
func.apply(value, arguments); func.apply(value, arguments);
// Firefox < 10, IE compatibility mode, and IE < 9 have buggy Array // avoid array-like object bugs with `Array#shift` and `Array#splice` in
// `shift()` and `splice()` functions that fail to remove the last element, // Firefox < 10 and IE < 9
// `value[0]`, of array-like objects even though the `length` property is if (hasObjectSpliceBug && value.length === 0) {
// set to `0`. The `shift()` method is buggy in IE 8 compatibility mode,
// while `splice()` is buggy regardless of mode in IE < 9 and buggy in
// compatibility mode in IE 9.
if (value.length === 0) {
delete value[0]; delete value[0];
} }
if (this._chain) { if (this._chain) {

76
lodash.min.js vendored
View File

@@ -1,41 +1,41 @@
/*! /*!
Lo-Dash 0.5.2 lodash.com/license Lo-Dash 0.6.1 lodash.com/license
Underscore.js 1.3.3 github.com/documentcloud/underscore/blob/master/LICENSE Underscore.js 1.3.3 github.com/documentcloud/underscore/blob/master/LICENSE
*/ */
;(function(e,t){"use strict";function s(e){return new o(e)}function o(e){if(e&&e._wrapped)return e;this._wrapped=e}function u(e,t,n){t||(t=0);var r=e.length,i=r-t>=(n||30),s=i?{}:e;if(i)for(var o=t-1;++o<r;)n=e[o]+"",(ot.call(s,n)?s[n]:s[n]=[]).push(e[o]);return function(e){if(i){var n=e+"";return ot.call(s,n)&&-1<C(s[n],e)}return-1<C(s,e,t)}}function a(){for(var e,t,n,s=-1,o=arguments.length,u={e:"",f:"",j:"",q:"",c:{d:""},m:{d:""}};++s<o;)for(t in e=arguments[s],e)n=(n=e[t])==r?"":n,/d|i/.test(t ;(function(e,t){function s(e){return new o(e)}function o(e){if(e&&e._wrapped)return e;this._wrapped=e}function u(e,t,n){t||(t=0);var r=e.length,i=r-t>=(n||V),s=i?{}:e;if(i)for(var o=t-1;++o<r;)n=e[o]+"",(ft.call(s,n)?s[n]:s[n]=[]).push(e[o]);return function(e){if(i){var n=e+"";return ft.call(s,n)&&-1<k(s[n],e)}return-1<k(s,e,t)}}function a(){for(var e,t,n,s=-1,o=arguments.length,u={e:"",f:"",j:"",q:"",c:{d:""},m:{d:""}};++s<o;)for(t in e=arguments[s],e)n=(n=e[t])==r?"":n,/d|i/.test(t)?
)?("string"==typeof n&&(n={b:n,l:n}),u.c[t]=n.b,u.m[t]=n.l):u[t]=n;e=u.a,t=/^[^,]+/.exec(e)[0],u.g=t,u.h=Nt,u.k=Pt,u.n=kt,u.p=nt,u.r=u.r!==i,u.s=u.s!==i,"o"in u||(u.o=Ot),u.f||(u.f="if(!"+t+")return s");if("b"!=t||!u.c.i)u.c=r;t="",u.s&&(t+="'use strict';"),t+="var g,y,h="+u.g+",s",u.j&&(t+="="+u.j),t+=";"+u.f+";"+u.q+";",u.c&&(t+="var j=h.length;g=-1;",u.m&&(t+="if(j>-1&&j===j>>>0){"),u.o&&(t+="if(x.call(h)==v){h=h.split('')}"),t+=u.c.d+";while(++g<j){y=h[g];"+u.c.i+"}",u.m&&(t+="}"));if(u.m){u. ("string"==typeof n&&(n={b:n,l:n}),u.c[t]=n.b||"",u.m[t]=n.l||""):u[t]=n;e=u.a,t=/^[^,]+/.exec(e)[0],n=u.s,u.g=t,u.h=Lt,u.k=Ft,u.n=Mt,u.p=st,u.r=u.r!==i,u.s=n==r?It:n,u.o==r&&(u.o=Pt),u.f||(u.f="if(!"+t+")return u");if("d"!=t||!u.c.i)u.c=r;t="",u.s&&(t+="'use strict';"),t+="var i,A,j="+u.g+",u",u.j&&(t+="="+u.j),t+=";"+u.f+";"+u.q+";",u.c&&(t+="var l=j.length;i=-1;",u.m&&(t+="if(l>-1&&l===l>>>0){"),u.o&&(t+="if(z.call(j)==x){j=j.split('')}"),t+=u.c.d+";while(++i<l){A=j[i];"+u.c.i+"}",u.m&&(t+="}"
c?t+="else{":u.n&&(t+="var j=h.length;g=-1;if(j&&P(h)){while(++g<j){y=h[g+=''];"+u.m.i+"}}else{"),u.h||(t+="var t=typeof h=='function'&&p.call(h,'prototype');"),u.k&&u.r?(t+="var m=-1,n=Y[typeof h]?k(h):[],j=n.length;"+u.m.d+";while(++m<j){g=n[m];",u.h||(t+="if(!(t&&g=='prototype')){"),t+="y=h[g];"+u.m.i+"",u.h||(t+="}")):(t+=u.m.d+";for(g in h){",u.h?(u.r&&(t+="if(e.call(h,g)){"),t+="y=h[g];"+u.m.i+";",u.r&&(t+="}")):(t+="if(!(t&&g=='prototype')",u.r&&(t+="&&e.call(h,g)"),t+="){y=h[g];"+u.m.i+"}" ));if(u.m){u.c?t+="else{":u.n&&(t+="var l=j.length;i=-1;if(l&&P(j)){while(++i<l){A=j[i+=''];"+u.m.i+"}}else{"),u.h||(t+="var v=typeof j=='function'&&r.call(j,'prototype');");if(u.k&&u.r)t+="var o=-1,p=Y[typeof j]?m(j):[],l=p.length;"+u.m.d+";while(++o<l){i=p[o];",u.h||(t+="if(!(v&&i=='prototype')){"),t+="A=j[i];"+u.m.i+"",u.h||(t+="}");else{t+=u.m.d+";for(i in j){";if(!u.h||u.r)t+="if(",u.h||(t+="!(v&&i=='prototype')"),!u.h&&u.r&&(t+="&&"),u.r&&(t+="g.call(j,i)"),t+="){";t+="A=j[i];"+u.m.i+";";if(!
)),t+="}";if(u.h){t+="var d=h.constructor;";for(n=0;7>n;n++)t+="g='"+u.p[n]+"';if(","constructor"==u.p[n]&&(t+="!(d&&d.prototype===h)&&"),t+="e.call(h,g)){y=h[g];"+u.m.i+"}"}if(u.c||u.n)t+="}"}return t+=u.e+";return s",Function("D,E,F,I,c,K,e,f,N,P,R,T,U,i,X,Y,k,p,u,v,x","var G=function("+e+"){"+t+"};return G")(Ht,I,M,f,st,Zt,ot,_,C,b,Jt,w,p,d,wt,Ft,dt,at,ft,St,lt)}function f(e,n){var r=e.b,i=n.b,e=e.a,n=n.a;return e===t?1:n===t?-1:e<n?-1:e>n?1:r<i?-1:1}function l(e,t){return it[t]}function c(e){ u.h||u.r)t+="}"}t+="}";if(u.h){t+="var f=j.constructor;";for(n=0;7>n;n++)t+="i='"+u.p[n]+"';if(","constructor"==u.p[n]&&(t+="!(f&&f.prototype===j)&&"),t+="g.call(j,i)){A=j[i];"+u.m.i+"}"}if(u.c||u.n)t+="}"}return t+=u.e+";return u",Function("D,E,F,I,e,K,g,h,N,P,R,T,U,k,X,Y,m,r,w,x,z","var G=function("+e+"){"+t+"};return G")(qt,q,_,f,at,un,ft,D,k,b,tn,w,E,p,xt,Wt,gt,ct,ht,Nt,pt)}function f(e,n){var r=e.b,i=n.b,e=e.a,n=n.a;return e===t?1:n===t?-1:e<n?-1:e>n?1:r<i?-1:1}function l(e,t){return ut[t]}function c
return"\\"+It[e]}function h(e){return jt[e]}function p(e,t){var n=i;if(!e||"object"!=typeof e||!t&&b(e))return n;var r=e.constructor;return(!Mt||"function"==typeof e.toString||"string"!=typeof (e+""))&&(!w(r)||r instanceof r)?Ct?(Zt(e,function(t,r){return n=!ot.call(e,r),i}),n===i):(Zt(e,function(e,t){n=t}),n===i||ot.call(e,n)):n}function d(e,t){return function(n,r,i){return e.call(t,n,r,i)}}function v(){}function m(e,t){if(e&&V.test(t))return"<e%-"+t+"%>";var n=it.length;return it[n]="'+__e("+t+")+'" (e){return"\\"+Xt[e]}function h(e){return Ut[e]}function p(e,t){return function(n,r,i){return e.call(t,n,r,i)}}function d(){}function v(e,t){if(e&&J.test(t))return"<e%-"+t+"%>";var n=ut.length;return ut[n]="'+__e("+t+")+'",ot+n}function m(e,t,n,i){return i?(e=ut.length,ut[e]="';"+i+";__p+='",ot+e):t?v(r,t):g(r,n)}function g(e,t){if(e&&J.test(t))return"<e%="+t+"%>";var n=ut.length;return ut[n]="'+((__t=("+t+"))==null?'':__t)+'",ot+n}function y(e){return zt[e]}function b(e){return pt.call(e)==yt}function w
,rt+n}function g(e,t,n,i){return i?(e=it.length,it[e]="';"+i+";__p+='",rt+e):t?m(r,t):y(r,n)}function y(e,t){if(e&&V.test(t))return"<e%="+t+"%>";var n=it.length;return it[n]="'+((__t=("+t+"))==null?'':__t)+'",rt+n}function b(e){return lt.call(e)==vt}function w(e){return"function"==typeof e}function E(e,t,s,o,u){if(e==r)return e;s&&(t=i),u||(u={d:r}),u.d==r&&(u.d=!(!q.clone&&!U.clone&&!z.clone));if(((s=Ft[typeof e])||u.d)&&e.clone&&w(e.clone))return u.d=r,e.clone(t);if(s){var a=lt.call(e);if(!Bt[a (e){return"function"==typeof e}function E(e,t){return e?e==U||e.__proto__==U&&(t||!b(e)):i}function S(e,t,s,o,u){if(e==r)return e;s&&(t=i),u||(u={d:r}),u.d==r&&(u.d=!(!R.clone&&!z.clone&&!W.clone));if(((s=Wt[typeof e])||u.d)&&e.clone&&w(e.clone))return u.d=r,e.clone(t);if(s){var a=pt.call(e);if(!Rt[a]||_t&&b(e))return e;var f=a==bt,s=f||(a==xt?E(e,n):s)}if(!s||!t)return s?f?ht.call(e):on({},e):e;s=e.constructor;switch(a){case wt:return new s(e==n);case Et:return new s(+e);case St:case Nt:return new
]||Lt&&b(e))return e;var f=a==mt,s=f||(a==wt?p(e,n):s)}if(!s||!t)return s?f?ft.call(e):Yt({},e):e;s=e.constructor;switch(a){case gt:return new s(e==n);case yt:return new s(+e);case bt:case St:return new s(e);case Et:return s(e.source,Q.exec(e))}o||(o=[]);for(a=o.length;a--;)if(o[a].c==e)return o[a].d;var a=e.length,l=f?s(a):{};o.push({d:l,c:e});if(f)for(f=-1;++f<a;)l[f]=E(e[f],t,r,o,u);else en(e,function(e,n){l[n]=E(e,t,r,o,u)});return l}function S(e,t,s,o){if(e==r||t==r)return e===t;o||(o={value s(e);case Tt:return s(e.source,Z.exec(e))}o||(o=[]);for(a=o.length;a--;)if(o[a].c==e)return o[a].d;var a=e.length,l=f?s(a):{};o.push({d:l,c:e});if(f)for(f=-1;++f<a;)l[f]=S(e[f],t,r,o,u);else an(e,function(e,n){l[n]=S(e,t,r,o,u)});return l}function x(e,t,s,o){if(e==r||t==r)return e===t;o||(o={value:r}),o.value==r&&(o.value=!(!R.isEqual&&!z.isEqual&&!W.isEqual));if(Wt[typeof e]||Wt[typeof t]||o.value){e._chain&&(e=e._wrapped),t._chain&&(t=t._wrapped);if(e.isEqual&&w(e.isEqual))return o.value=r,e.isEqual
:r}),o.value==r&&(o.value=!(!q.isEqual&&!U.isEqual&&!z.isEqual));if(Ft[typeof e]||Ft[typeof t]||o.value){e._chain&&(e=e._wrapped),t._chain&&(t=t._wrapped);if(e.isEqual&&w(e.isEqual))return o.value=r,e.isEqual(t);if(t.isEqual&&w(t.isEqual))return o.value=r,t.isEqual(e)}if(e===t)return 0!==e||1/e==1/t;var u=lt.call(e);if(u!=lt.call(t))return i;switch(u){case gt:case yt:return+e==+t;case bt:return e!=+e?t!=+t:0==e?1/e==1/t:e==+t;case Et:case St:return e==t+""}var a=Ht[u];if(Lt&&!a&&(a=b(e))&&!b(t)||! (t);if(t.isEqual&&w(t.isEqual))return o.value=r,t.isEqual(e)}if(e===t)return 0!==e||1/e==1/t;var u=pt.call(e);if(u!=pt.call(t))return i;switch(u){case wt:case Et:return+e==+t;case St:return e!=+e?t!=+t:0==e?1/e==1/t:e==+t;case Tt:case Nt:return e==t+""}var a=qt[u];if(_t&&!a&&(a=b(e))&&!b(t)||!a&&(u!=xt||Ht&&("function"!=typeof e.toString&&"string"==typeof (e+"")||"function"!=typeof t.toString&&"string"==typeof (t+""))))return i;s||(s=[]);for(u=s.length;u--;)if(s[u]==e)return n;var u=-1,f=n,l=0;s.
a&&(u!=wt||Mt&&("function"!=typeof e.toString&&"string"==typeof (e+"")||"function"!=typeof t.toString&&"string"==typeof (t+""))))return i;s||(s=[]);for(u=s.length;u--;)if(s[u]==e)return n;var u=-1,f=n,l=0;s.push(e);if(a){l=e.length;if(f=l==t.length)for(;l--&&(f=S(e[l],t[l],s,o)););return f}a=e.constructor,f=t.constructor;if(a!=f&&(!w(a)||!(a instanceof a&&w(f)&&f instanceof f)))return i;for(var c in e)if(ot.call(e,c)&&(l++,!ot.call(t,c)||!S(e[c],t[c],s,o)))return i;for(c in t)if(ot.call(t,c)&&!(l-- push(e);if(a){l=e.length;if(f=l==t.length)for(;l--&&(f=x(e[l],t[l],s,o)););return f}a=e.constructor,f=t.constructor;if(a!=f&&(!w(a)||!(a instanceof a&&w(f)&&f instanceof f)))return i;for(var c in e)if(ft.call(e,c)&&(l++,!ft.call(t,c)||!x(e[c],t[c],s,o)))return i;for(c in t)if(ft.call(t,c)&&!(l--))return i;if(Lt)for(;7>++u;)if(c=st[u],ft.call(e,c)&&(!ft.call(t,c)||!x(e[c],t[c],s,o)))return i;return n}function T(e,t,n,r){if(!e)return n;var i=e.length,s=3>arguments.length;r&&(t=p(t,r));if(-1<i&&i===
))return i;if(Nt)for(;7>++u;)if(c=nt[u],ot.call(e,c)&&(!ot.call(t,c)||!S(e[c],t[c],s,o)))return i;return n}function x(e,t,n,r){if(!e)return n;var i=e.length,s=3>arguments.length;r&&(t=d(t,r));if(-1<i&&i===i>>>0){var o=Ot&&lt.call(e)==St?e.split(""):e;for(i&&s&&(n=o[--i]);i--;)n=t(n,o[i],i,e);return n}o=rn(e);for((i=o.length)&&s&&(n=e[o[--i]]);i--;)s=o[i],n=t(n,e[s],s,e);return n}function T(e,t,n){if(e)return t==r||n?e[0]:ft.call(e,0,t)}function N(e,t){var n=[];if(!e)return n;for(var r,i=-1,s=e.length i>>>0){var o=Pt&&pt.call(e)==Nt?e.split(""):e;for(i&&s&&(n=o[--i]);i--;)n=t(n,o[i],i,e);return n}o=cn(e);for((i=o.length)&&s&&(n=e[o[--i]]);i--;)s=o[i],n=t(n,e[s],s,e);return n}function N(e,t,n){if(e)return t==r||n?e[0]:ht.call(e,0,t)}function C(e,t){var n=[];if(!e)return n;for(var r,i=-1,s=e.length;++i<s;)r=e[i],tn(r)?lt.apply(n,t?r:C(r)):n.push(r);return n}function k(e,t,n){if(!e)return-1;var r=-1,i=e.length;if(n){if("number"!=typeof n)return r=O(e,t),e[r]===t?r:-1;r=(0>n?Math.max(0,i+n):n)-1}for(
;++i<s;)r=e[i],Jt(r)?ut.apply(n,t?r:N(r)):n.push(r);return n}function C(e,t,n){if(!e)return-1;var r=-1,i=e.length;if(n){if("number"!=typeof n)return r=A(e,t),e[r]===t?r:-1;r=(0>n?Math.max(0,i+n):n)-1}for(;++r<i;)if(e[r]===t)return r;return-1}function k(e,t,n){var r=-Infinity,i=r;if(!e)return i;var s=-1,o=e.length;if(!t){for(;++s<o;)e[s]>i&&(i=e[s]);return i}for(n&&(t=d(t,n));++s<o;)n=t(e[s],s,e),n>r&&(r=n,i=e[s]);return i}function L(e,t,n){return e?ft.call(e,t==r||n?1:t):[]}function A(e,t,n,r){if(! ;++r<i;)if(e[r]===t)return r;return-1}function L(e,t,n){var r=-Infinity,i=r;if(!e)return i;var s=-1,o=e.length;if(!t){for(;++s<o;)e[s]>i&&(i=e[s]);return i}for(n&&(t=p(t,n));++s<o;)n=t(e[s],s,e),n>r&&(r=n,i=e[s]);return i}function A(e,t,n){return e?ht.call(e,t==r||n?1:t):[]}function O(e,t,n,r){if(!e)return 0;var i=0,s=e.length;if(n){r&&(n=_(n,r));for(t=n(t);i<s;)r=i+s>>>1,n(e[r])<t?i=r+1:s=r}else for(;i<s;)r=i+s>>>1,e[r]<t?i=r+1:s=r;return i}function M(e,t,n,r){var s=[];if(!e)return s;var o=-1,u=
e)return 0;var i=0,s=e.length;if(n){r&&(n=M(n,r));for(t=n(t);i<s;)r=i+s>>>1,n(e[r])<t?i=r+1:s=r}else for(;i<s;)r=i+s>>>1,e[r]<t?i=r+1:s=r;return i}function O(e,t,n,r){var s=[];if(!e)return s;var o=-1,u=e.length,a=[];"function"==typeof t&&(r=n,n=t,t=i);for(n?r&&(n=d(n,r)):n=_;++o<u;)if(r=n(e[o],o,e),t?!o||a[a.length-1]!==r:0>C(a,r))a.push(r),s.push(e[o]);return s}function M(e,t){function n(){var o=arguments,u=t;return i||(e=t[r]),s.length&&(o=o.length?s.concat(ft.call(o)):s),this instanceof n?(v.prototype= e.length,a=[];"function"==typeof t&&(r=n,n=t,t=i);for(n?r&&(n=p(n,r)):n=D;++o<u;)if(r=n(e[o],o,e),t?!o||a[a.length-1]!==r:0>k(a,r))a.push(r),s.push(e[o]);return s}function _(e,t){function n(){var o=arguments,u=t;return i||(e=t[r]),s.length&&(o=o.length?s.concat(ht.call(o)):s),this instanceof n?(d.prototype=e.prototype,u=new d,(o=e.apply(u,o))&&Wt[typeof o]?o:u):e.apply(u,o)}var r,i=w(e);if(i){if(jt||dt&&2<arguments.length)return dt.call.apply(dt,arguments)}else r=t,t=e;var s=ht.call(arguments,2);
e.prototype,u=new v,(o=e.apply(u,o))&&Ft[typeof o]?o:u):e.apply(u,o)}var r,i=w(e);if(i){if(Dt||ct&&2<arguments.length)return ct.call.apply(ct,arguments)}else r=t,t=e;var s=ft.call(arguments,2);return n}function _(e){return e}function D(e){hn(tn(e),function(t){var r=s[t]=e[t];o.prototype[t]=function(){var e=[this._wrapped];return arguments.length&&ut.apply(e,arguments),e=r.apply(s,e),this._chain&&(e=new o(e),e._chain=n),e}})}var n=!0,r=null,i=!1,P,H,B,j,F="object"==typeof exports&&exports&&("object"==typeof return n}function D(e){return e}function P(e){wn(fn(e),function(t){var r=s[t]=e[t];o.prototype[t]=function(){var e=[this._wrapped];return arguments.length&&lt.apply(e,arguments),e=r.apply(s,e),this._chain&&(e=new o(e),e._chain=n),e}})}var n=!0,r=null,i=!1,H,B,j,F,I="object"==typeof exports&&exports&&("object"==typeof global&&global&&global==global.global&&(e=global),exports),q=Array.prototype,R=Boolean.prototype,U=Object.prototype,z=Number.prototype,W=String.prototype,X=0,V=30,$=e._,J=/[-+=!~*%&^<>|{(\/]|\[\D|\b(?:delete|in|instanceof|new|typeof|void)\b/
global&&global&&global==global.global&&(e=global),exports),I=Array.prototype,q=Boolean.prototype,R=Object.prototype,U=Number.prototype,z=String.prototype,W=0,X=e._,V=/[-+=!~*%&^<>|{(\/]|\[\D|\b(?:delete|in|instanceof|new|typeof|void)\b/,$=/\b__p\+='';/g,J=/\b(__p\+=)''\+/g,K=/(__e\(.*?\)|\b__t\))\+'';/g,Q=/\w*$/,G=/(?:__e|__t=)\(\s*(?![\d\s"']|this\.)/g,Y=RegExp("^"+(R.valueOf+"").replace(/[.*+?^=!:${}()|[\]\/\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),Z=/__token__(\d+)/g,et=/[&<"']/g ,K=/&(?:amp|lt|gt|quot|#x27);/g,Q=/\b__p\+='';/g,G=/\b(__p\+=)''\+/g,Y=/(__e\(.*?\)|\b__t\))\+'';/g,Z=/\w*$/,et=/(?:__e|__t=)\(\s*(?![\d\s"']|this\.)/g,tt=RegExp("^"+(U.valueOf+"").replace(/[.*+?^=!:${}()|[\]\/\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),nt=/__token__(\d+)/g,rt=/[&<>"']/g,it=/['\n\r\t\u2028\u2029\\]/g,st="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),ot="__token__",ut=[],at=q.concat,ft=U.hasOwnProperty,lt=q.push
,tt=/['\n\r\t\u2028\u2029\\]/g,nt="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),rt="__token__",it=[],st=I.concat,ot=R.hasOwnProperty,ut=I.push,at=R.propertyIsEnumerable,ft=I.slice,lt=R.toString,ct=Y.test(ct=ft.bind)&&ct,ht=Y.test(ht=Array.isArray)&&ht,pt=e.isFinite,dt=Y.test(dt=Object.keys)&&dt,vt="[object Arguments]",mt="[object Array]",gt="[object Boolean]",yt="[object Date]",bt="[object Number]",wt="[object Object]",Et="[object RegExp]" ,ct=U.propertyIsEnumerable,ht=q.slice,pt=U.toString,dt=tt.test(dt=ht.bind)&&dt,vt=tt.test(vt=Array.isArray)&&vt,mt=e.isFinite,gt=tt.test(gt=Object.keys)&&gt,yt="[object Arguments]",bt="[object Array]",wt="[object Boolean]",Et="[object Date]",St="[object Number]",xt="[object Object]",Tt="[object RegExp]",Nt="[object String]",Ct=e.clearTimeout,kt=e.setTimeout,Lt,At,Ot,Mt=n;(function(){function e(){this.x=1}var t={0:1,length:1},n=[];e.prototype={valueOf:1,y:1};for(var r in new e)n.push(r);for(r in arguments
,St="[object String]",xt=e.clearTimeout,Tt=e.setTimeout,Nt,Ct,kt=n;(function(){function e(){this.x=1}var t=[];e.prototype={valueOf:1,y:1};for(var n in new e)t.push(n);for(n in arguments)kt=!n;Nt=4>(t+"").length,Ct="x"!=t[0]})(1);var Lt=!b(arguments),At="x"!=ft.call("x")[0],Ot="xx"!="x"[0]+Object("x")[0];try{var Mt=("[object Object]",lt.call(e.document||0)==wt)}catch(_t){}var Dt=ct&&/\n|Opera/.test(ct+lt.call(e.opera)),Pt=dt&&/^.+$|true/.test(dt+!!e.attachEvent),Ht={"[object Arguments]":n,"[object Array]" )Mt=!r;Lt=4>(n+"").length,Ot="x"!=n[0],At=(n.splice.call(t,0,1),t[0])})(1);var _t=!b(arguments),Dt="x"!=ht.call("x")[0],Pt="xx"!="x"[0]+Object("x")[0];try{var Ht=("[object Object]",pt.call(e.document||0)==xt)}catch(Bt){}var jt=dt&&/\n|Opera/.test(dt+pt.call(e.opera)),Ft=gt&&/^.+$|true/.test(gt+!!e.attachEvent),It=!jt,qt={"[object Arguments]":n,"[object Array]":n,"[object Boolean]":i,"[object Date]":i,"[object Function]":i,"[object Number]":i,"[object Object]":i,"[object RegExp]":i,"[object String]"
:n,"[object Boolean]":i,"[object Date]":i,"[object Function]":i,"[object Number]":i,"[object Object]":i,"[object RegExp]":i,"[object String]":n},Bt={"[object Arguments]":i,"[object Array]":n,"[object Boolean]":n,"[object Date]":n,"[object Function]":i,"[object Number]":n,"[object Object]":n,"[object RegExp]":n,"[object String]":n},jt={"&":"&amp;","<":"&lt;",'"':"&quot;","'":"&#x27;"},Ft={"boolean":i,"function":n,object:n,number:i,string:i,"undefined":i,unknown:n},It={"\\":"\\","'":"'","\n":"n","\r" :n},Rt={"[object Arguments]":i,"[object Array]":n,"[object Boolean]":n,"[object Date]":n,"[object Function]":i,"[object Number]":n,"[object Object]":n,"[object RegExp]":n,"[object String]":n},Ut={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;"},zt={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#x27;":"'"},Wt={"boolean":i,"function":n,object:n,number:i,string:i,"undefined":i,unknown:n},Xt={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"};s.templateSettings=
:"r"," ":"t","\u2028":"u2028","\u2029":"u2029"};s.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""};var qt={a:"b,a,w",j:"b",q:"if(!a)a=f;else if(w)a=i(a,w)",i:"if(a(y,g,b)===false)return s"},Rt={j:"{}",q:"var o;if(typeof a!='function'){var ii=a;a=function(y){return y[ii]}}else if(w)a=i(a,w)",i:"o=a(y,g,b);(e.call(s,o)?s[o]++:s[o]=1)"},Ut={j:"true",i:"if(!a(y,g,b))return!s"},zt={r:i,s:i,a:"l",j:"l",q:"for(var B=1,C=arguments.length;B<C;B++){if(h=arguments[B]){" {escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""};var Vt={a:"d,c,y",j:"d",q:"if(!c)c=h;else if(y)c=k(c,y)",i:"if(c(A,i,d)===false)return u"},$t={j:"{}",q:"var q;if(typeof c!='function'){var ii=c;c=function(A){return A[ii]}}else if(y)c=k(c,y)",i:"q=c(A,i,d);(g.call(u,q)?u[q]++:u[q]=1)"},Jt={r:i,a:"n,c,y",j:"{}",q:"var S=typeof c=='function';if(!S){var t=e.apply(E,arguments)}else if(y)c=k(c,y)",i:"if(S?!c(A,i,n):N(t,i)<0)u[i]=A"},Kt={j:"true",i:"if(!c(A,i,d))return!u"
,i:"s[g]=y",e:"}}"},Wt={j:"[]",i:"a(y,g,b)&&s.push(y)"},Xt={q:"if(w)a=i(a,w)"},Vt={i:{l:qt.i}},$t={j:"",f:"if(!b)return[]",d:{b:"s=Array(j)",l:"s="+(Pt?"Array(j)":"[]")},i:{b:"s[g]=a(y,g,b)",l:"s"+(Pt?"[m]=":".push")+"(a(y,g,b))"}};Lt&&(b=function(e){return!!e&&!!ot.call(e,"callee")});var Jt=ht||function(e){return lt.call(e)==mt};w(/x/)&&(w=function(e){return"[object Function]"==lt.call(e)});var Kt=a({a:"l",j:"[]",i:"s.push(g)"}),Qt=a(zt,{i:"if(s[g]==null)"+zt.i}),Gt=a({r:i,a:"l",j:"{}",q:"var r=c.apply(E,arguments)" },Qt={r:i,s:i,a:"n",j:"n",q:"for(var a=1,b=arguments.length;a<b;a++){if(j=arguments[a]){",i:"u[i]=A",e:"}}"},Gt={j:"[]",i:"c(A,i,d)&&u.push(A)"},Yt={q:"if(y)c=k(c,y)"},Zt={i:{l:Vt.i}},en={j:"",f:"if(!d)return[]",d:{b:"u=Array(l)",l:"u="+(Ft?"Array(l)":"[]")},i:{b:"u[i]=c(A,i,d)",l:"u"+(Ft?"[o]=":".push")+"(c(A,i,d))"}};_t&&(b=function(e){return!!e&&!!ft.call(e,"callee")});var tn=vt||function(e){return pt.call(e)==bt};w(/x/)&&(w=function(e){return"[object Function]"==pt.call(e)}),E(Wt)||(E=function(
,i:"if(N(r,g)<0)s[g]=y"}),Yt=a(zt),Zt=a(qt,Xt,Vt,{r:i}),en=a(qt,Xt,Vt),tn=a({r:i,a:"l",j:"[]",i:"if(T(y))s.push(g)",e:"s.sort()"}),nn=a({a:"y",j:"true",q:"var H=x.call(y),j=y.length;if(D[H]"+(Lt?"||P(y)":"")+"||(H==X&&j>-1&&j===j>>>0&&T(y.splice)))return!j",i:{l:"return false"}}),rn=dt?function(e){var t=typeof e;return"function"==t&&at.call(e,"prototype")?Kt(e):e&&Ft[t]?dt(e):[]}:Kt,sn=a(zt,{a:"l,ee,O,ff",q:"var J,L,Q,gg,dd=O==U;if(!dd)ff=[];for(var B=1,C=dd?2:arguments.length;B<C;B++){if(h=arguments[B]){" e,t){var n=i;if(!e||"object"!=typeof e||!t&&b(e))return n;var r=e.constructor;return(!Ht||"function"==typeof e.toString||"string"!=typeof (e+""))&&(!w(r)||r instanceof r)?Ot?(un(e,function(t,r){return n=!ft.call(e,r),i}),n===i):(un(e,function(e,t){n=t}),n===i||ft.call(e,n)):n});var nn=a({a:"n",j:"[]",i:"u.push(i)"}),rn=a(Qt,{i:"if(u[i]==null)"+Qt.i}),sn=a(Jt),on=a(Qt),un=a(Vt,Yt,Zt,{r:i}),an=a(Vt,Yt,Zt),fn=a({r:i,a:"n",j:"[]",i:"if(T(A))u.push(i)",e:"u.sort()"}),ln=a({a:"A",j:"true",q:"var H=z.call(A),l=A.length;if(D[H]"+
,i:"if(y&&((Q=R(y))||U(y))){L=false;gg=ff.length;while(gg--)if(L=ff[gg].c==y)break;if(L){s[g]=ff[gg].d}else{J=(J=s[g])&&Q?(R(J)?J:[]):(U(J)?J:{});ff.push({d:J,c:y});s[g]=G(J,y,U,ff)}}else if(y!=null)s[g]=y"}),on=a({a:"l",j:"[]",i:"s.push(y)"}),un=a({a:"b,hh",j:"false",o:i,d:{b:"if(x.call(h)==v)return b.indexOf(hh)>-1"},i:"if(y===hh)return true"}),an=a(qt,Rt),fn=a(qt,Ut),ln=a(qt,Wt),cn=a(qt,Xt,{j:"",i:"if(a(y,g,b))return y"}),hn=a(qt,Xt),pn=a(qt,Rt,{i:"o=a(y,g,b);(e.call(s,o)?s[o]:s[o]=[]).push(y)" (_t?"||P(A)":"")+"||(H==X&&l>-1&&l===l>>>0&&T(A.splice)))return!l",i:{l:"return false"}}),cn=gt?function(e){var t=typeof e;return"function"==t&&ct.call(e,"prototype")?nn(e):e&&Wt[t]?gt(e):[]}:nn,hn=a(Qt,{a:"n,ee,O,ff",q:"var J,L,Q,gg,dd=O==U;if(!dd)ff=[];for(var a=1,b=dd?2:arguments.length;a<b;a++){if(j=arguments[a]){",i:"if(A&&((Q=R(A))||U(A))){L=false;gg=ff.length;while(gg--)if(L=ff[gg].c==A)break;if(L){u[i]=ff[gg].d}else{J=(J=u[i])&&Q?(R(J)?J:[]):(U(J)?J:{});ff.push({d:J,c:A});u[i]=G(J,A,U,ff)}}else if(A!=null)u[i]=A"
}),dn=a($t,{a:"b,V",q:"var A=u.call(arguments,2),S=typeof V=='function'",i:{b:"s[g]=(S?V:y[V]).apply(y,A)",l:"s"+(Pt?"[m]=":".push")+"((S?V:y[V]).apply(y,A))"}}),vn=a(qt,$t),mn=a($t,{a:"b,bb",i:{b:"s[g]=y[bb]",l:"s"+(Pt?"[m]=":".push")+"(y[bb])"}}),gn=a({a:"b,a,z,w",j:"z",q:"var W=arguments.length<3;if(w)a=i(a,w)",d:{b:"if(W)s=b[++g]"},i:{b:"s=a(s,y,g,b)",l:"s=W?(W=false,y):a(s,y,g,b)"}}),yn=a(qt,Wt,{i:"!"+Wt.i}),bn=a(qt,Ut,{j:"false",i:Ut.i.replace("!","")}),wn=a(qt,Rt,$t,{i:{b:"s[g]={a:a(y,g,b),b:g,d:y}" }),pn=a(Jt,{q:"if(typeof c!='function'){var q,t=e.apply(E,arguments),l=t.length;for(i=1;i<l;i++){q=t[i];if(q in n)u[q]=n[q]}}else{if(y)c=k(c,y)",i:"if(c(A,i,n))u[i]=A",e:"}"}),dn=a({a:"n",j:"[]",i:"u.push(A)"}),vn=a({a:"d,hh",j:"false",o:i,d:{b:"if(z.call(d)==x)return d.indexOf(hh)>-1"},i:"if(A===hh)return true"}),mn=a(Vt,$t),gn=a(Vt,Kt),yn=a(Vt,Gt),bn=a(Vt,Yt,{j:"",i:"if(c(A,i,d))return A"}),wn=a(Vt,Yt),En=a(Vt,$t,{i:"q=c(A,i,d);(g.call(u,q)?u[q]:u[q]=[]).push(A)"}),Sn=a(en,{a:"d,V",q:"var C=w.call(arguments,2),S=typeof V=='function'"
,l:"s"+(Pt?"[m]=":".push")+"({a:a(y,g,b),b:g,d:y})"},e:"s.sort(I);j=s.length;while(j--)s[j]=s[j].d"}),En=a(Wt,{a:"b,aa",q:"var Z,o,q,r=[];K(aa,function(y,o){r.push(o)});var cc=r.length",i:"for(Z=true,q=0;q<cc;q++){o=r[q];if(!(Z=y[o]===aa[o]))break}if(Z)s.push(y)"}),Sn=a({r:i,s:i,a:"l",j:"l",q:"var M=arguments,j=M.length;if(j>1){for(var g=1;g<j;g++)s[M[g]]=F(s[M[g]],s);return s}",i:"if(T(s[g]))s[g]=F(s[g],s)"});s.VERSION="0.5.2",s.after=function(e,t){return 1>e?t():function(){if(1>--e)return t.apply ,i:{b:"u[i]=(S?V:A[V]).apply(A,C)",l:"u"+(Ft?"[o]=":".push")+"((S?V:A[V]).apply(A,C))"}}),xn=a(Vt,en),Tn=a(en,{a:"d,bb",i:{b:"u[i]=A[bb]",l:"u"+(Ft?"[o]=":".push")+"(A[bb])"}}),Nn=a({a:"d,c,B,y",j:"B",q:"var W=arguments.length<3;if(y)c=k(c,y)",d:{b:"if(W)u=j[++i]"},i:{b:"u=c(u,A,i,d)",l:"u=W?(W=false,A):c(u,A,i,d)"}}),Cn=a(Vt,Gt,{i:"!"+Gt.i}),kn=a(Vt,Kt,{j:"false",i:Kt.i.replace("!","")}),Ln=a(Vt,$t,en,{i:{b:"u[i]={a:c(A,i,d),b:i,d:A}",l:"u"+(Ft?"[o]=":".push")+"({a:c(A,i,d),b:i,d:A})"},e:"u.sort(I);l=u.length;while(l--)u[l]=u[l].d"
(this,arguments)}},s.bind=M,s.bindAll=Sn,s.chain=function(e){return e=new o(e),e._chain=n,e},s.clone=E,s.compact=function(e){var t=[];if(!e)return t;for(var n=-1,r=e.length;++n<r;)e[n]&&t.push(e[n]);return t},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=un,s.countBy=an,s.debounce=function(e,t,n){function i(){a=r,n||e.apply(u,s)}var s,o,u,a;return function(){var r=n&&!a;return s=arguments,u=this,xt(a),a=Tt }),An=a(Gt,{a:"d,aa",q:"var t=[];K(aa,function(A,q){t.push(q)});var cc=t.length",i:"for(var q,Z=true,s=0;s<cc;s++){q=t[s];if(!(Z=A[q]===aa[q]))break}Z&&u.push(A)"}),On=a({r:i,s:i,a:"n",j:"n",q:"var M=arguments,l=M.length;if(l>1){for(var i=1;i<l;i++)u[M[i]]=F(u[M[i]],u);return u}",i:"if(T(u[i]))u[i]=F(u[i],u)"});s.VERSION="0.6.1",s.after=function(e,t){return 1>e?t():function(){if(1>--e)return t.apply(this,arguments)}},s.bind=_,s.bindAll=On,s.chain=function(e){return e=new o(e),e._chain=n,e},s.clone=
(i,t),r&&(o=e.apply(u,s)),o}},s.defaults=Qt,s.defer=function(e){var n=ft.call(arguments,1);return Tt(function(){return e.apply(t,n)},1)},s.delay=function(e,n){var r=ft.call(arguments,2);return Tt(function(){return e.apply(t,r)},n)},s.difference=function(e){var t=[];if(!e)return t;for(var n=-1,r=e.length,i=st.apply(t,arguments),i=u(i,r);++n<r;)i(e[n])||t.push(e[n]);return t},s.drop=Gt,s.escape=function(e){return e==r?"":(e+"").replace(et,h)},s.every=fn,s.extend=Yt,s.filter=ln,s.find=cn,s.first=T,s S,s.compact=function(e){var t=[];if(!e)return t;for(var n=-1,r=e.length;++n<r;)e[n]&&t.push(e[n]);return t},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=vn,s.countBy=mn,s.debounce=function(e,t,n){function i(){a=r,n||e.apply(u,s)}var s,o,u,a;return function(){var r=n&&!a;return s=arguments,u=this,Ct(a),a=kt(i,t),r&&(o=e.apply(u,s)),o}},s.defaults=rn,s.defer=function(e){var n=ht.call(arguments,1);return kt
.flatten=N,s.forEach=hn,s.forIn=Zt,s.forOwn=en,s.functions=tn,s.groupBy=pn,s.has=function(e,t){return e?ot.call(e,t):i},s.identity=_,s.indexOf=C,s.initial=function(e,t,n){return e?ft.call(e,0,-(t==r||n?1:t)):[]},s.intersection=function(e){var t=[];if(!e)return t;for(var n,r=-1,i=e.length,s=ft.call(arguments,1),o=[];++r<i;)n=e[r],0>C(t,n)&&fn(s,function(e,t){return(o[t]||(o[t]=u(e)))(n)})&&t.push(n);return t},s.invoke=dn,s.isArguments=b,s.isArray=Jt,s.isBoolean=function(e){return e===n||e===i||lt. (function(){return e.apply(t,n)},1)},s.delay=function(e,n){var r=ht.call(arguments,2);return kt(function(){return e.apply(t,r)},n)},s.difference=function(e){var t=[];if(!e)return t;for(var n=-1,r=e.length,i=at.apply(t,arguments),i=u(i,r);++n<r;)i(e[n])||t.push(e[n]);return t},s.drop=sn,s.escape=function(e){return e==r?"":(e+"").replace(rt,h)},s.every=gn,s.extend=on,s.filter=yn,s.find=bn,s.first=N,s.flatten=C,s.forEach=wn,s.forIn=un,s.forOwn=an,s.functions=fn,s.groupBy=En,s.has=function(e,t){return e?
call(e)==gt},s.isElement=function(e){return e?1===e.nodeType:i},s.isEmpty=nn,s.isEqual=S,s.isFinite=function(e){return pt(e)&&lt.call(e)==bt},s.isFunction=w,s.isNaN=function(e){return lt.call(e)==bt&&e!=+e},s.isNull=function(e){return e===r},s.isObject=function(e){return e?Ft[typeof e]:i},s.isUndefined=function(e){return e===t},s.keys=rn,s.last=function(e,t,n){if(e){var i=e.length;return t==r||n?e[i-1]:ft.call(e,-t||i)}},s.lastIndexOf=function(e,t,n){if(!e)return-1;var r=e.length;for(n&&"number"==typeof ft.call(e,t):i},s.identity=D,s.indexOf=k,s.initial=function(e,t,n){return e?ht.call(e,0,-(t==r||n?1:t)):[]},s.intersection=function(e){var t=[];if(!e)return t;var n,r=arguments.length,i=[],s=-1,o=e.length;e:for(;++s<o;)if(n=e[s],0>k(t,n)){for(var a=1;a<r;a++)if(!(i[a]||(i[a]=u(arguments[a])))(n))continue e;t.push(n)}return t},s.invoke=Sn,s.isArguments=b,s.isArray=tn,s.isBoolean=function(e){return e===n||e===i||pt.call(e)==wt},s.isElement=function(e){return e?1===e.nodeType:i},s.isEmpty=ln,s.isEqual=
n&&(r=(0>n?Math.max(0,r+n):Math.min(n,r-1))+1);r--;)if(e[r]===t)return r;return-1},s.map=vn,s.max=k,s.memoize=function(e,t){var n={};return function(){var r=t?t.apply(this,arguments):arguments[0];return ot.call(n,r)?n[r]:n[r]=e.apply(this,arguments)}},s.merge=sn,s.min=function(e,t,n){var r=Infinity,i=r;if(!e)return i;var s=-1,o=e.length;if(!t){for(;++s<o;)e[s]<i&&(i=e[s]);return i}for(n&&(t=d(t,n));++s<o;)n=t(e[s],s,e),n<r&&(r=n,i=e[s]);return i},s.mixin=D,s.noConflict=function(){return e._=X,this x,s.isFinite=function(e){return mt(e)&&pt.call(e)==St},s.isFunction=w,s.isNaN=function(e){return pt.call(e)==St&&e!=+e},s.isNull=function(e){return e===r},s.isObject=function(e){return e?Wt[typeof e]:i},s.isUndefined=function(e){return e===t},s.keys=cn,s.last=function(e,t,n){if(e){var i=e.length;return t==r||n?e[i-1]:ht.call(e,-t||i)}},s.lastIndexOf=function(e,t,n){if(!e)return-1;var r=e.length;for(n&&"number"==typeof n&&(r=(0>n?Math.max(0,r+n):Math.min(n,r-1))+1);r--;)if(e[r]===t)return r;return-1
},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){var t=ft.call(arguments,1),n=t.length;return function(){var r;return r=arguments,r.length&&(t.length=n,ut.apply(t,r)),r=1==t.length?e.call(this,t[0]):e.apply(this,t),t.length=n,r}},s.pick=function(e){var t={};if(!e)return t;for(var n,r=0,i=st.apply(I,arguments),s=i.length;++r<s;)n=i[r],n in e&&(t[n]=e[n]);return t},s.pluck=mn,s.range=function(e,t,n){e=+e||0,n=+n||1,t==r&&(t=e, },s.map=xn,s.max=L,s.memoize=function(e,t){var n={};return function(){var r=t?t.apply(this,arguments):arguments[0];return ft.call(n,r)?n[r]:n[r]=e.apply(this,arguments)}},s.merge=hn,s.min=function(e,t,n){var r=Infinity,i=r;if(!e)return i;var s=-1,o=e.length;if(!t){for(;++s<o;)e[s]<i&&(i=e[s]);return i}for(n&&(t=p(t,n));++s<o;)n=t(e[s],s,e),n<r&&(r=n,i=e[s]);return i},s.mixin=P,s.noConflict=function(){return e._=$,this},s.once=function(e){var t,s=i;return function(){return s?t:(s=n,t=e.apply(this,
e=0);for(var i=-1,t=Math.max(0,Math.ceil((t-e)/n)),s=Array(t);++i<t;)s[i]=e,e+=n;return s},s.reduce=gn,s.reduceRight=x,s.reject=yn,s.rest=L,s.result=function(e,t){if(!e)return r;var n=e[t];return w(n)?e[t]():n},s.shuffle=function(e){if(!e)return[];for(var t,n=-1,r=e.length,i=Array(r);++n<r;)t=Math.floor(Math.random()*(n+1)),i[n]=i[t],i[t]=e[n];return i},s.size=function(e){if(!e)return 0;var t=lt.call(e),n=e.length;return Ht[t]||Lt&&b(e)||t==wt&&-1<n&&n===n>>>0&&w(e.splice)?n:rn(e).length},s.some= arguments),e=r,t)}},s.partial=function(e){var t=ht.call(arguments,1),n=t.length;return function(){var r;return r=arguments,r.length&&(t.length=n,lt.apply(t,r)),r=1==t.length?e.call(this,t[0]):e.apply(this,t),t.length=n,r}},s.pick=pn,s.pluck=Tn,s.range=function(e,t,n){e=+e||0,n=+n||1,t==r&&(t=e,e=0);for(var i=-1,t=Math.max(0,Math.ceil((t-e)/n)),s=Array(t);++i<t;)s[i]=e,e+=n;return s},s.reduce=Nn,s.reduceRight=T,s.reject=Cn,s.rest=A,s.result=function(e,t){if(!e)return r;var n=e[t];return w(n)?e[t](
bn,s.sortBy=wn,s.sortedIndex=A,s.tap=function(e,t){return t(e),e},s.template=function(e,t,n){n||(n={});var e=e+"",o,u;o=n.escape;var a=n.evaluate,f=n.interpolate,h=s.templateSettings,p=n=n.variable||h.variable;o==r&&(o=h.escape),a==r&&(a=h.evaluate||i),f==r&&(f=h.interpolate),o&&(e=e.replace(o,m)),f&&(e=e.replace(f,y)),a!=P&&(P=a,j=RegExp("<e%-([\\s\\S]+?)%>|<e%=([\\s\\S]+?)%>"+(a?"|"+a.source:""),"g")),o=it.length,e=e.replace(j,g),o=o!=it.length,e="__p += '"+e.replace(tt,c).replace(Z,l)+"';",it. ):n},s.shuffle=function(e){if(!e)return[];for(var t,n=-1,r=e.length,i=Array(r);++n<r;)t=Math.floor(Math.random()*(n+1)),i[n]=i[t],i[t]=e[n];return i},s.size=function(e){if(!e)return 0;var t=pt.call(e),n=e.length;return qt[t]||_t&&b(e)||t==xt&&-1<n&&n===n>>>0&&w(e.splice)?n:cn(e).length},s.some=kn,s.sortBy=Ln,s.sortedIndex=O,s.tap=function(e,t){return t(e),e},s.template=function(e,t,n){n||(n={});var e=e+"",o,u;o=n.escape;var a=n.evaluate,f=n.interpolate,h=s.templateSettings,p=n=n.variable||h.variable
length=0,p||(n=H||"obj",o?e="with("+n+"){"+e+"}":(n!=H&&(H=n,B=RegExp("(\\(\\s*)"+n+"\\."+n+"\\b","g")),e=e.replace(G,"$&"+n+".").replace(B,"$1__d"))),e=(o?e.replace($,""):e).replace(J,"$1").replace(K,"$1;"),e="function("+n+"){"+(p?"":n+"||("+n+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":(p?"":",__d="+n+"."+n+"||"+n)+";")+e+"return __p}";try{u=Function("_","return "+e)(s)}catch(d){u=function(){throw d}}return t?u(t):(u.source= ;o==r&&(o=h.escape),a==r&&(a=h.evaluate||i),f==r&&(f=h.interpolate),o&&(e=e.replace(o,v)),f&&(e=e.replace(f,g)),a!=H&&(H=a,F=RegExp("<e%-([\\s\\S]+?)%>|<e%=([\\s\\S]+?)%>"+(a?"|"+a.source:""),"g")),o=ut.length,e=e.replace(F,m),o=o!=ut.length,e="__p += '"+e.replace(it,c).replace(nt,l)+"';",ut.length=0,p||(n=B||"obj",o?e="with("+n+"){"+e+"}":(n!=B&&(B=n,j=RegExp("(\\(\\s*)"+n+"\\."+n+"\\b","g")),e=e.replace(et,"$&"+n+".").replace(j,"$1__d"))),e=(o?e.replace(Q,""):e).replace(G,"$1").replace(Y,"$1;")
e,u)},s.throttle=function(e,t){function n(){a=new Date,u=r,e.apply(o,i)}var i,s,o,u,a=0;return function(){var r=new Date,f=t-(r-a);return i=arguments,o=this,0>=f?(a=r,s=e.apply(o,i)):u||(u=Tt(n,f)),s}},s.times=function(e,t,n){var r=-1;if(n)for(;++r<e;)t.call(n,r);else for(;++r<e;)t(r)},s.toArray=function(e){if(!e)return[];if(e.toArray&&w(e.toArray))return e.toArray();var t=e.length;return-1<t&&t===t>>>0?(At?lt.call(e)==St:"string"==typeof e)?e.split(""):ft.call(e):on(e)},s.union=function(){for(var e=-1 ,e="function("+n+"){"+(p?"":n+"||("+n+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":(p?"":",__d="+n+"."+n+"||"+n)+";")+e+"return __p}";try{u=Function("_","return "+e)(s)}catch(d){u=function(){throw d}}return t?u(t):(u.source=e,u)},s.throttle=function(e,t){function n(){a=new Date,u=r,e.apply(o,i)}var i,s,o,u,a=0;return function(){var r=new Date,f=t-(r-a);return i=arguments,o=this,0>=f?(a=r,s=e.apply(o,i)):u||(u=kt(n,f)),s}},s.times=
,t=[],n=st.apply(t,arguments),r=n.length;++e<r;)0>C(t,n[e])&&t.push(n[e]);return t},s.uniq=O,s.uniqueId=function(e){var t=W++;return e?e+t:t},s.values=on,s.where=En,s.without=function(e){var t=[];if(!e)return t;for(var n=-1,r=e.length,i=u(arguments,1,20);++n<r;)i(e[n])||t.push(e[n]);return t},s.wrap=function(e,t){return function(){var n=[e];return arguments.length&&ut.apply(n,arguments),t.apply(this,n)}},s.zip=function(e){if(!e)return[];for(var t=-1,n=k(mn(arguments,"length")),r=Array(n);++t<n;)r function(e,t,n){var r=-1;if(n)for(;++r<e;)t.call(n,r);else for(;++r<e;)t(r)},s.toArray=function(e){if(!e)return[];if(e.toArray&&w(e.toArray))return e.toArray();var t=e.length;return-1<t&&t===t>>>0?(Dt?pt.call(e)==Nt:"string"==typeof e)?e.split(""):ht.call(e):dn(e)},s.unescape=function(e){return e==r?"":(e+"").replace(K,y)},s.union=function(){for(var e=-1,t=[],n=at.apply(t,arguments),r=n.length;++e<r;)0>k(t,n[e])&&t.push(n[e]);return t},s.uniq=M,s.uniqueId=function(e){var t=X++;return e?e+t:t},s.values=
[t]=mn(arguments,t);return r},s.zipObject=function(e,t){if(!e)return{};var n=-1,r=e.length,i={};for(t||(t=[]);++n<r;)i[e[n]]=t[n];return i},s.all=fn,s.any=bn,s.collect=vn,s.detect=cn,s.each=hn,s.foldl=gn,s.foldr=x,s.head=T,s.include=un,s.inject=gn,s.methods=tn,s.select=ln,s.tail=L,s.take=T,s.unique=O,hn({Date:yt,Number:bt,RegExp:Et,String:St},function(e,t){s["is"+t]=function(t){return lt.call(t)==e}}),o.prototype=s.prototype,D(s),o.prototype.chain=function(){return this._chain=n,this},o.prototype dn,s.where=An,s.without=function(e){var t=[];if(!e)return t;for(var n=-1,r=e.length,i=u(arguments,1,20);++n<r;)i(e[n])||t.push(e[n]);return t},s.wrap=function(e,t){return function(){var n=[e];return arguments.length&&lt.apply(n,arguments),t.apply(this,n)}},s.zip=function(e){if(!e)return[];for(var t=-1,n=L(Tn(arguments,"length")),r=Array(n);++t<n;)r[t]=Tn(arguments,t);return r},s.zipObject=function(e,t){if(!e)return{};var n=-1,r=e.length,i={};for(t||(t=[]);++n<r;)i[e[n]]=t[n];return i},s.all=gn,s.
.value=function(){return this._wrapped},hn("pop push reverse shift sort splice unshift".split(" "),function(e){var t=I[e];o.prototype[e]=function(){var e=this._wrapped;return t.apply(e,arguments),e.length===0&&delete e[0],this._chain&&(e=new o(e),e._chain=n),e}}),hn(["concat","join","slice"],function(e){var t=I[e];o.prototype[e]=function(){var e=t.apply(this._wrapped,arguments);return this._chain&&(e=new o(e),e._chain=n),e}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(e._= any=kn,s.collect=xn,s.detect=bn,s.each=wn,s.foldl=Nn,s.foldr=T,s.head=N,s.include=vn,s.inject=Nn,s.methods=fn,s.omit=sn,s.select=yn,s.tail=A,s.take=N,s.unique=M,wn({Date:Et,Number:St,RegExp:Tt,String:Nt},function(e,t){s["is"+t]=function(t){return pt.call(t)==e}}),o.prototype=s.prototype,P(s),o.prototype.chain=function(){return this._chain=n,this},o.prototype.value=function(){return this._wrapped},wn("pop push reverse shift sort splice unshift".split(" "),function(e){var t=q[e];o.prototype[e]=function(
s,define(function(){return s})):F?"object"==typeof module&&module&&module.t==F?(module.t=s)._=s:F._=s:e._=s})(this); ){var e=this._wrapped;return t.apply(e,arguments),At&&e.length===0&&delete e[0],this._chain&&(e=new o(e),e._chain=n),e}}),wn(["concat","join","slice"],function(e){var t=q[e];o.prototype[e]=function(){var e=t.apply(this._wrapped,arguments);return this._chain&&(e=new o(e),e._chain=n),e}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(e._=s,define(function(){return s})):I?"object"==typeof module&&module&&module.t==I?(module.t=s)._=s:I._=s:e._=s})(this);

View File

@@ -1,6 +1,6 @@
{ {
"name": "lodash", "name": "lodash",
"version": "0.5.2", "version": "0.6.1",
"description": "A drop-in replacement for Underscore.js delivering performance, bug fixes, and additional features.", "description": "A drop-in replacement for Underscore.js delivering performance, bug fixes, and additional features.",
"homepage": "http://lodash.com", "homepage": "http://lodash.com",
"main": "lodash", "main": "lodash",

View File

@@ -200,7 +200,7 @@
}\ }\
}\ }\
\ \
if (typeof countBy != "undefined") {\ if (typeof countBy != "undefined" || typeof omit != "undefined") {\
var wordToNumber = {\ var wordToNumber = {\
"one": 1,\ "one": 1,\
"two": 2,\ "two": 2,\
@@ -226,7 +226,22 @@
"twenty-two": 22,\ "twenty-two": 22,\
"twenty-three": 23,\ "twenty-three": 23,\
"twenty-four": 24,\ "twenty-four": 24,\
"twenty-five": 25\ "twenty-five": 25,\
"twenty-six": 26,\
"twenty-seven": 27,\
"twenty-eight": 28,\
"twenty-nine": 29,\
"thirty": 30,\
"thirty-one": 31,\
"thirty-two": 32,\
"thirty-three": 33,\
"thirty-four": 34,\
"thirty-five": 35,\
"thirty-six": 36,\
"thirty-seven": 37,\
"thirty-eight": 38,\
"thirty-nine": 39,\
"forty": 40\
};\ };\
\ \
var words = belt.keys(wordToNumber).slice(0, limit);\ var words = belt.keys(wordToNumber).slice(0, limit);\
@@ -1065,6 +1080,30 @@
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
suites.push(
Benchmark.Suite('`_.omit` iterating 20 properties, omitting 2 keys')
.add('Lo-Dash', '\
lodash.omit(object, "key6", "key13")'
)
.add('Underscore', '\
_.omit(object, "key6", "key13")'
)
);
suites.push(
Benchmark.Suite('`_.omit` iterating 40 properties, omitting 20 keys')
.add('Lo-Dash', {
'fn': 'lodash.omit(wordToNumber, words)',
'teardown': 'function omit(){}'
})
.add('Underscore', {
'fn': 'result = _.omit(wordToNumber, words)',
'teardown': 'function omit(){}'
})
);
/*--------------------------------------------------------------------------*/
suites.push( suites.push(
Benchmark.Suite('`_.pick`') Benchmark.Suite('`_.pick`')
.add('Lo-Dash', '\ .add('Lo-Dash', '\
@@ -1309,42 +1348,6 @@
) )
); );
suites.push(
Benchmark.Suite('`_.union` iterating an array of 25 elements')
.add('Lo-Dash', {
'fn': 'lodash.union(twentyFiveValues, twentyFiveValues2)',
'teardown': 'function multiArrays(){}'
})
.add('Underscore', {
'fn': '_.union(twentyFiveValues, twentyFiveValues2)',
'teardown': 'function multiArrays(){}'
})
);
suites.push(
Benchmark.Suite('`_.union` iterating an array of 50 elements')
.add('Lo-Dash', {
'fn': 'lodash.union(fiftyValues, fiftyValues2)',
'teardown': 'function multiArrays(){}'
})
.add('Underscore', {
'fn': '_.union(fiftyValues, fiftyValues2)',
'teardown': 'function multiArrays(){}'
})
);
suites.push(
Benchmark.Suite('`_.union` iterating an array of 75 elements')
.add('Lo-Dash', {
'fn': 'lodash.union(seventyFiveValues, seventyFiveValues2)',
'teardown': 'function multiArrays(){}'
})
.add('Underscore', {
'fn': '_.union(seventyFiveValues, seventyFiveValues2)',
'teardown': 'function multiArrays(){}'
})
);
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
suites.push( suites.push(

View File

@@ -289,13 +289,13 @@
QUnit.module('lodash.countBy'); QUnit.module('lodash.countBy');
(function() { (function() {
test('should only add elements to own, not inherited, properties', function() { test('should only add values to own, not inherited, properties', function() {
var actual = _.countBy([4.2, 6.1, 6.4], function(num) { var actual = _.countBy([4.2, 6.1, 6.4], function(num) {
return Math.floor(num) > 4 ? 'hasOwnProperty' : 'constructor'; return Math.floor(num) > 4 ? 'hasOwnProperty' : 'constructor';
}); });
deepEqual(actual.constructor, 1); equal(actual.constructor, 1);
deepEqual(actual.hasOwnProperty, 2); equal(actual.hasOwnProperty, 2);
}); });
}()); }());
@@ -336,11 +336,11 @@
QUnit.module('lodash.drop'); QUnit.module('lodash.drop');
(function() { (function() {
var object = { 'a': 1, 'b': 2, 'c': 3 }, var object = { 'a': 1, 'b': 2 },
actual = { 'b': 2 }; actual = { 'b': 2 };
test('should accept individual property names', function() { test('should accept individual property names', function() {
deepEqual(_.drop(object, 'a', 'c'), actual); deepEqual(_.drop(object, 'a'), actual);
}); });
test('should accept an array of property names', function() { test('should accept an array of property names', function() {
@@ -355,7 +355,38 @@
function Foo() {} function Foo() {}
Foo.prototype = object; Foo.prototype = object;
deepEqual(_.drop(new Foo, 'a', 'c'), actual); deepEqual(_.drop(new Foo, 'a'), actual);
});
test('should work with a `callback` argument', function() {
var actual = _.drop(object, function(value) {
return value == 1;
});
deepEqual(actual, { 'b': 2 });
});
test('should pass the correct `callback` arguments', function() {
var args,
lastKey = _.keys(object).pop();
var expected = lastKey == 'b'
? [1, 'a', object]
: [2, 'b', object];
_.drop(object, function() {
args || (args = slice.call(arguments));
});
deepEqual(args, expected);
});
test('should correct set the `this` binding', function() {
var actual = _.drop(object, function(value) {
return value == this.a;
}, { 'a': 1 });
deepEqual(actual, { 'b': 2 });
}); });
}()); }());
@@ -364,15 +395,11 @@
QUnit.module('lodash.escape'); QUnit.module('lodash.escape');
(function() { (function() {
test('should not escape the ">" character', function() {
equal(_.escape('>'), '>');
});
test('should not escape the "/" character', function() { test('should not escape the "/" character', function() {
equal(_.escape('/'), '/'); equal(_.escape('/'), '/');
}); });
test('should return empty string when passed `null` or `undefined`', function() { test('should return an empty string when passed `null` or `undefined`', function() {
equal(_.escape(null), ''); equal(_.escape(null), '');
equal(_.escape(undefined), ''); equal(_.escape(undefined), '');
}); });
@@ -620,7 +647,7 @@
deepEqual(actual, { '4': [4.2], '6': [6.1, 6.4] }); deepEqual(actual, { '4': [4.2], '6': [6.1, 6.4] });
}); });
test('should only add elements to own, not inherited, properties', function() { test('should only add values to own, not inherited, properties', function() {
var actual = _.groupBy([4.2, 6.1, 6.4], function(num) { var actual = _.groupBy([4.2, 6.1, 6.4], function(num) {
return Math.floor(num) > 4 ? 'hasOwnProperty' : 'constructor'; return Math.floor(num) > 4 ? 'hasOwnProperty' : 'constructor';
}); });
@@ -1057,11 +1084,11 @@
}); });
test('should not alter the `this` binding of either function', function() { test('should not alter the `this` binding of either function', function() {
var o = { 'cat': 'nip' }, var object = { 'cat': 'nip' },
func = function() { return this.cat; }; func = function() { return this.cat; };
equal(_.partial(_.bind(func, o))(), o.cat); equal(_.partial(_.bind(func, object))(), object.cat);
equal(_.bind(_.partial(func), o)(), o.cat); equal(_.bind(_.partial(func), object)(), object.cat);
}); });
}()); }());
@@ -1070,12 +1097,45 @@
QUnit.module('lodash.pick'); QUnit.module('lodash.pick');
(function() { (function() {
var object = { 'a': 1, 'b': 2 };
test('should iterate over inherited properties', function() { test('should iterate over inherited properties', function() {
function Foo() {} function Foo() {}
Foo.prototype = { 'a': 1, 'b': 2, 'c': 3 }; Foo.prototype = object;
deepEqual(_.pick(new Foo, 'b'), { 'b': 2 }); deepEqual(_.pick(new Foo, 'b'), { 'b': 2 });
}); });
test('should work with a `callback` argument', function() {
var actual = _.pick(object, function(value) {
return value == 2;
});
deepEqual(actual, { 'b': 2 });
});
test('should pass the correct `callback` arguments', function() {
var args,
lastKey = _.keys(object).pop();
var expected = lastKey == 'b'
? [1, 'a', object]
: [2, 'b', object];
_.pick(object, function() {
args || (args = slice.call(arguments));
});
deepEqual(args, expected);
});
test('should correct set the `this` binding', function() {
var actual = _.pick(object, function(value) {
return value == this.b;
}, { 'b': 2 });
deepEqual(actual, { 'b': 2 });
});
}()); }());
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
@@ -1115,17 +1175,41 @@
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
QUnit.module('lodash.reduce');
(function() {
_.each({
'literal': 'abc',
'object': Object('abc')
},
function(collection, key) {
test('should work with a string ' + key + ' for `collection` (test in IE < 9)', function() {
var args;
var actual = _.reduce(collection, function(accumulator, value) {
args || (args = slice.call(arguments));
return accumulator + value;
});
deepEqual(args, ['a', 'b', 1, collection]);
equal(actual, 'abc');
});
});
}());
/*--------------------------------------------------------------------------*/
QUnit.module('lodash.reduceRight'); QUnit.module('lodash.reduceRight');
(function() { (function() {
test('should pass the correct `callback` arguments when iterating an object', function() { test('should pass the correct `callback` arguments when iterating an object', function() {
var args, var args,
object = { 'a': 'A', 'b': 'B' }, object = { 'a': 1, 'b': 2 },
lastKey = _.keys(object).pop(); lastKey = _.keys(object).pop();
var expected = lastKey == 'a' var expected = lastKey == 'b'
? ['A', 'B', 'b', object] ? [2, 1, 'a', object]
: ['B', 'A', 'a', object]; : [1, 2, 'b', object];
_.reduceRight(object, function() { _.reduceRight(object, function() {
args || (args = slice.call(arguments)); args || (args = slice.call(arguments));
@@ -1136,12 +1220,12 @@
test('should treat array-like object with invalid `length` as a regular object', function() { test('should treat array-like object with invalid `length` as a regular object', function() {
var args, var args,
object = { 'a': 'A', 'length': -1 }, object = { 'a': 1, 'length': -1 },
lastKey = _.keys(object).pop(); lastKey = _.keys(object).pop();
var expected = lastKey == 'a' var expected = lastKey == 'length'
? ['A', '-1', 'length', object] ? [-1, 1, 'a', object]
: [-1, 'A', 'a', object]; : [1, -1, 'length', object];
_.reduceRight(object, function() { _.reduceRight(object, function() {
args || (args = slice.call(arguments)); args || (args = slice.call(arguments));
@@ -1452,6 +1536,32 @@
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
QUnit.module('lodash.unescape');
(function() {
var escaped = '&lt;h1&gt;Moe&#x27;s famous &quot;death by chocolate&quot; brownies &amp; cake&lt;\/h1&gt;',
unescaped = '<h1>Moe\'s famous "death by chocolate" brownies & cake<\/h1>';
test('should unescape entities in the correct order', function() {
equal(_.unescape('&amp;lt;'), '&lt;');
});
test('should unescape the proper entities', function() {
equal(_.unescape(escaped), unescaped);
});
test('should unescape the same characters escaped by `_.escape`', function() {
equal(_.unescape(_.escape(unescaped)), unescaped);
});
test('should return an empty string when passed `null` or `undefined`', function() {
equal(_.unescape(null), '');
equal(_.unescape(undefined), '');
});
}());
/*--------------------------------------------------------------------------*/
QUnit.module('lodash.uniq'); QUnit.module('lodash.uniq');
(function() { (function() {

View File

@@ -791,14 +791,14 @@
// collection immediately, unless `wait: true` is passed, in which case we // collection immediately, unless `wait: true` is passed, in which case we
// wait for the server to agree. // wait for the server to agree.
create: function(model, options) { create: function(model, options) {
var coll = this; var collection = this;
options = options ? _.clone(options) : {}; options = options ? _.clone(options) : {};
model = this._prepareModel(model, options); model = this._prepareModel(model, options);
if (!model) return false; if (!model) return false;
if (!options.wait) coll.add(model, options); if (!options.wait) collection.add(model, options);
var success = options.success; var success = options.success;
options.success = function(model, resp, options) { options.success = function(model, resp, options) {
if (options.wait) coll.add(model, options); if (options.wait) collection.add(model, options);
if (success) success(model, resp, options); if (success) success(model, resp, options);
}; };
model.save(null, options); model.save(null, options);
@@ -1314,14 +1314,6 @@
}); });
// The self-propagating extend function that Backbone classes use.
var extend = function(protoProps, classProps) {
return inherits(this, protoProps, classProps);
};
// Set up inheritance for the model, collection, and view.
Model.extend = Collection.extend = Router.extend = View.extend = extend;
// Backbone.sync // Backbone.sync
// ------------- // -------------
@@ -1421,7 +1413,8 @@
// Helper function to correctly set up the prototype chain, for subclasses. // Helper function to correctly set up the prototype chain, for subclasses.
// Similar to `goog.inherits`, but uses a hash of prototype properties and // Similar to `goog.inherits`, but uses a hash of prototype properties and
// class properties to be extended. // class properties to be extended.
var inherits = function(parent, protoProps, staticProps) { var extend = function(protoProps, staticProps) {
var parent = this;
var child; var child;
// The constructor function for the new subclass is either defined by you // The constructor function for the new subclass is either defined by you
@@ -1457,6 +1450,9 @@
return child; return child;
}; };
// Set up inheritance for the model, collection, and view.
Model.extend = Collection.extend = Router.extend = View.extend = extend;
// Helper function to get a value from a Backbone object as a property // Helper function to get a value from a Backbone object as a property
// or as a function. // or as a function.
var getValue = function(object, prop) { var getValue = function(object, prop) {

View File

@@ -14,7 +14,7 @@ For a list of upcoming features, check out our [roadmap](https://github.com/best
## Support ## Support
Benchmark.js has been tested in at least Adobe AIR 3.1, Chrome 5-21, Firefox 1.5-13, IE 6-9, Opera 9.25-12.01, Safari 3-6, Node.js 0.8.7, Narwhal 0.3.2, RingoJS 0.8, and Rhino 1.7RC5. Benchmark.js has been tested in at least Adobe AIR 3.1, Chrome 5-21, Firefox 1-15, IE 6-9, Opera 9.25-12, Safari 3-6, Node.js 0.8.8, Narwhal 0.3.2, RingoJS 0.8, and Rhino 1.7RC5.
## Installation and usage ## Installation and usage

View File

@@ -196,7 +196,7 @@ class Entry {
* @returns {Array} The entry `param` data. * @returns {Array} The entry `param` data.
*/ */
public function getParams( $index = null ) { public function getParams( $index = null ) {
preg_match_all('#\*\s*@param\s+\{([^}]+)\}\s+(\[.+\]|[$\w]+)\s+([\s\S]*?)(?=\*\s\@[a-z]|\*/)#i', $this->entry, $result); preg_match_all('#\*\s*@param\s+\{([^}]+)\}\s+(\[.+\]|[$\w|]+(?:\[.+\])?)\s+([\s\S]*?)(?=\*\s\@[a-z]|\*/)#i', $this->entry, $result);
if (count($result = array_filter(array_slice($result, 1)))) { if (count($result = array_filter(array_slice($result, 1)))) {
// repurpose array // repurpose array
foreach ($result as $param) { foreach ($result as $param) {
@@ -204,7 +204,7 @@ class Entry {
if (!is_array($result[0][$key])) { if (!is_array($result[0][$key])) {
$result[0][$key] = array(); $result[0][$key] = array();
} }
$result[0][$key][] = trim(preg_replace('/(?:^|\n)\s*\* ?/', ' ', $value)); $result[0][$key][] = trim(preg_replace('/(?:^|\n)\s*\* */', ' ', $value));
} }
} }
$result = $result[0]; $result = $result[0];

View File

@@ -163,7 +163,7 @@ class Generator {
$member = !$member ? $entry->getMembers(0) : $member; $member = !$member ? $entry->getMembers(0) : $member;
$result = ($member ? $member . ($entry->isPlugin() ? 'prototype' : '') : '') . $entry->getCall(); $result = ($member ? $member . ($entry->isPlugin() ? 'prototype' : '') : '') . $entry->getCall();
$result = preg_replace('/\(\[|\[\]/', '', $result); $result = preg_replace('/\(\[|\[\]/', '', $result);
$result = preg_replace('/[ =\'"{}.()\]]/', '', $result); $result = preg_replace('/[ =|\'"{}.()\]]/', '', $result);
$result = preg_replace('/[[#,]/', '-', $result); $result = preg_replace('/[[#,]/', '-', $result);
return strtolower($result); return strtolower($result);
} }

View File

@@ -18,7 +18,7 @@ For a list of upcoming features, check out our [roadmap](https://github.com/best
## Support ## Support
Platform.js has been tested in at least Adobe AIR 3.1, Chrome 5-21, Firefox 1.5-13, IE 6-9, Opera 9.25-12.01, Safari 3-6, Node.js 0.8.6, Narwhal 0.3.2, RingoJS 0.8, and Rhino 1.7RC5. Platform.js has been tested in at least Adobe AIR 3.1, Chrome 5-21, Firefox 1-14, IE 6-9, Opera 9.25-12, Safari 3-6, Node.js 0.8.6, Narwhal 0.3.2, RingoJS 0.8, and Rhino 1.7RC5.
## Installation and usage ## Installation and usage

View File

@@ -48,6 +48,24 @@ $(document).ready(function() {
ok(_.isEqual(result, {b:2, c:3}), 'can restrict properties to those named in an array'); ok(_.isEqual(result, {b:2, c:3}), 'can restrict properties to those named in an array');
result = _.pick({a:1, b:2, c:3}, ['a'], 'b'); result = _.pick({a:1, b:2, c:3}, ['a'], 'b');
ok(_.isEqual(result, {a:1, b:2}), 'can restrict properties to those named in mixed args'); ok(_.isEqual(result, {a:1, b:2}), 'can restrict properties to those named in mixed args');
var Obj = function(){};
Obj.prototype = {a: 1, b: 2, c: 3};
ok(_.isEqual(_.pick(new Obj, 'a', 'c'), {a:1, c: 3}), 'include prototype props');
});
test("objects: omit", function() {
var result;
result = _.omit({a:1, b:2, c:3}, 'b');
ok(_.isEqual(result, {a:1, c:3}), 'can omit a single named property');
result = _.omit({a:1, b:2, c:3}, 'a', 'c');
ok(_.isEqual(result, {b:2}), 'can omit several named properties');
result = _.omit({a:1, b:2, c:3}, ['b', 'c']);
ok(_.isEqual(result, {a:1}), 'can omit properties named in an array');
var Obj = function(){};
Obj.prototype = {a: 1, b: 2, c: 3};
ok(_.isEqual(_.omit(new Obj, 'b'), {a:1, c: 3}), 'include prototype props');
}); });
test("objects: defaults", function() { test("objects: defaults", function() {

View File

@@ -5,28 +5,28 @@
// Oliver Steele's Functional, and John Resig's Micro-Templating. // Oliver Steele's Functional, and John Resig's Micro-Templating.
// For all details and documentation: // For all details and documentation:
// http://documentcloud.github.com/underscore // http://documentcloud.github.com/underscore
(function(){var s=this,L=s._,p={},k=Array.prototype,q=Object.prototype,M=k.push,i=k.slice,N=k.unshift,m=q.toString,O=q.hasOwnProperty,z=k.forEach,A=k.map,B=k.reduce,C=k.reduceRight,D=k.filter,E=k.every,F=k.some,r=k.indexOf,G=k.lastIndexOf,q=Array.isArray,P=Object.keys,t=Function.prototype.bind,b=function(a){return new l(a)};"undefined"!==typeof exports?("undefined"!==typeof module&&module.exports&&(exports=module.exports=b),exports._=b):s._=b;b.VERSION="1.3.3";var j=b.each=b.forEach=function(a,c, (function(){var s=this,L=s._,o={},k=Array.prototype,p=Object.prototype,M=k.push,h=k.slice,N=k.unshift,m=p.toString,O=p.hasOwnProperty,z=k.forEach,A=k.map,B=k.reduce,C=k.reduceRight,D=k.filter,E=k.every,F=k.some,q=k.indexOf,G=k.lastIndexOf,p=Array.isArray,P=Object.keys,t=Function.prototype.bind,b=function(a){return new l(a)};"undefined"!==typeof exports?("undefined"!==typeof module&&module.exports&&(exports=module.exports=b),exports._=b):s._=b;b.VERSION="1.3.3";var i=b.each=b.forEach=function(a,c,
d){if(a!=null)if(z&&a.forEach===z)a.forEach(c,d);else if(a.length===+a.length)for(var e=0,f=a.length;e<f;e++){if(c.call(d,a[e],e,a)===p)break}else for(e in a)if(b.has(a,e)&&c.call(d,a[e],e,a)===p)break};b.map=b.collect=function(a,c,d){var b=[];if(a==null)return b;if(A&&a.map===A)return a.map(c,d);j(a,function(a,g,h){b[b.length]=c.call(d,a,g,h)});return b};b.reduce=b.foldl=b.inject=function(a,c,d,e){var f=arguments.length>2;a==null&&(a=[]);if(B&&a.reduce===B){e&&(c=b.bind(c,e));return f?a.reduce(c, d){if(a!=null)if(z&&a.forEach===z)a.forEach(c,d);else if(a.length===+a.length)for(var e=0,f=a.length;e<f;e++){if(c.call(d,a[e],e,a)===o)break}else for(e in a)if(b.has(a,e)&&c.call(d,a[e],e,a)===o)break};b.map=b.collect=function(a,c,d){var b=[];if(a==null)return b;if(A&&a.map===A)return a.map(c,d);i(a,function(a,g,j){b[b.length]=c.call(d,a,g,j)});return b};b.reduce=b.foldl=b.inject=function(a,c,d,e){var f=arguments.length>2;a==null&&(a=[]);if(B&&a.reduce===B){e&&(c=b.bind(c,e));return f?a.reduce(c,
d):a.reduce(c)}j(a,function(a,b,i){if(f)d=c.call(e,d,a,b,i);else{d=a;f=true}});if(!f)throw new TypeError("Reduce of empty array with no initial value");return d};b.reduceRight=b.foldr=function(a,c,d,e){var f=arguments.length>2;a==null&&(a=[]);if(C&&a.reduceRight===C){e&&(c=b.bind(c,e));return f?a.reduceRight(c,d):a.reduceRight(c)}var g=b.toArray(a).reverse();e&&!f&&(c=b.bind(c,e));return f?b.reduce(g,c,d,e):b.reduce(g,c)};b.find=b.detect=function(a,c,b){var e;H(a,function(a,g,h){if(c.call(b,a,g,h)){e= d):a.reduce(c)}i(a,function(a,b,h){if(f)d=c.call(e,d,a,b,h);else{d=a;f=true}});if(!f)throw new TypeError("Reduce of empty array with no initial value");return d};b.reduceRight=b.foldr=function(a,c,d,e){var f=arguments.length>2;a==null&&(a=[]);if(C&&a.reduceRight===C){e&&(c=b.bind(c,e));return f?a.reduceRight(c,d):a.reduceRight(c)}var g=b.toArray(a).reverse();e&&!f&&(c=b.bind(c,e));return f?b.reduce(g,c,d,e):b.reduce(g,c)};b.find=b.detect=function(a,c,b){var e;H(a,function(a,g,j){if(c.call(b,a,g,j)){e=
a;return true}});return e};b.filter=b.select=function(a,c,b){var e=[];if(a==null)return e;if(D&&a.filter===D)return a.filter(c,b);j(a,function(a,g,h){c.call(b,a,g,h)&&(e[e.length]=a)});return e};b.reject=function(a,c,b){var e=[];if(a==null)return e;j(a,function(a,g,h){c.call(b,a,g,h)||(e[e.length]=a)});return e};b.every=b.all=function(a,c,b){var e=true;if(a==null)return e;if(E&&a.every===E)return a.every(c,b);j(a,function(a,g,h){if(!(e=e&&c.call(b,a,g,h)))return p});return!!e};var H=b.some=b.any= a;return true}});return e};b.filter=b.select=function(a,c,b){var e=[];if(a==null)return e;if(D&&a.filter===D)return a.filter(c,b);i(a,function(a,g,j){c.call(b,a,g,j)&&(e[e.length]=a)});return e};b.reject=function(a,c,b){var e=[];if(a==null)return e;i(a,function(a,g,j){c.call(b,a,g,j)||(e[e.length]=a)});return e};b.every=b.all=function(a,c,b){var e=true;if(a==null)return e;if(E&&a.every===E)return a.every(c,b);i(a,function(a,g,j){if(!(e=e&&c.call(b,a,g,j)))return o});return!!e};var H=b.some=b.any=
function(a,c,d){c||(c=b.identity);var e=false;if(a==null)return e;if(F&&a.some===F)return a.some(c,d);j(a,function(a,b,h){if(e||(e=c.call(d,a,b,h)))return p});return!!e};b.include=b.contains=function(a,c){var b=false;if(a==null)return b;if(r&&a.indexOf===r)return a.indexOf(c)!=-1;return b=H(a,function(a){return a===c})};b.invoke=function(a,c){var d=i.call(arguments,2);return b.map(a,function(a){return(b.isFunction(c)?c:a[c]).apply(a,d)})};b.pluck=function(a,c){return b.map(a,function(a){return a[c]})}; function(a,c,d){c||(c=b.identity);var e=false;if(a==null)return e;if(F&&a.some===F)return a.some(c,d);i(a,function(a,b,j){if(e||(e=c.call(d,a,b,j)))return o});return!!e};b.include=b.contains=function(a,c){var b=false;if(a==null)return b;if(q&&a.indexOf===q)return a.indexOf(c)!=-1;return b=H(a,function(a){return a===c})};b.invoke=function(a,c){var d=h.call(arguments,2);return b.map(a,function(a){return(b.isFunction(c)?c:a[c]).apply(a,d)})};b.pluck=function(a,c){return b.map(a,function(a){return a[c]})};
b.max=function(a,c,d){if(!c&&b.isArray(a)&&a[0]===+a[0]&&a.length<65535)return Math.max.apply(Math,a);if(!c&&b.isEmpty(a))return-Infinity;var e={computed:-Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;b>=e.computed&&(e={value:a,computed:b})});return e.value};b.min=function(a,c,d){if(!c&&b.isArray(a)&&a[0]===+a[0]&&a.length<65535)return Math.min.apply(Math,a);if(!c&&b.isEmpty(a))return Infinity;var e={computed:Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;b<e.computed&&(e={value:a,computed:b})}); b.max=function(a,c,d){if(!c&&b.isArray(a)&&a[0]===+a[0]&&a.length<65535)return Math.max.apply(Math,a);if(!c&&b.isEmpty(a))return-Infinity;var e={computed:-Infinity};i(a,function(a,b,j){b=c?c.call(d,a,b,j):a;b>=e.computed&&(e={value:a,computed:b})});return e.value};b.min=function(a,c,d){if(!c&&b.isArray(a)&&a[0]===+a[0]&&a.length<65535)return Math.min.apply(Math,a);if(!c&&b.isEmpty(a))return Infinity;var e={computed:Infinity};i(a,function(a,b,j){b=c?c.call(d,a,b,j):a;b<e.computed&&(e={value:a,computed:b})});
return e.value};b.shuffle=function(a){var c,b=0,e=[];j(a,function(a){c=Math.floor(Math.random()*++b);e[b-1]=e[c];e[c]=a});return e};b.sortBy=function(a,c,d){var e=I(a,c);return b.pluck(b.map(a,function(a,c,b){return{value:a,criteria:e.call(d,a,c,b)}}).sort(function(a,c){var b=a.criteria,d=c.criteria;return b===void 0?1:d===void 0?-1:b<d?-1:b>d?1:0}),"value")};var I=function(a,c){return b.isFunction(c)?c:function(a){return a[c]}},J=function(a,c,b){var e={},f=I(a,c);j(a,function(a,c){var i=f(a,c);b(e, return e.value};b.shuffle=function(a){var c,b=0,e=[];i(a,function(a){c=Math.floor(Math.random()*++b);e[b-1]=e[c];e[c]=a});return e};b.sortBy=function(a,c,d){var e=I(a,c);return b.pluck(b.map(a,function(a,c,b){return{value:a,criteria:e.call(d,a,c,b)}}).sort(function(a,c){var b=a.criteria,d=c.criteria;return b===void 0?1:d===void 0?-1:b<d?-1:b>d?1:0}),"value")};var I=function(a,c){return b.isFunction(c)?c:function(a){return a[c]}},J=function(a,c,b){var e={},f=I(a,c);i(a,function(a,c){var h=f(a,c);b(e,
i,a)});return e};b.groupBy=function(a,c){return J(a,c,function(a,c,b){(a[c]||(a[c]=[])).push(b)})};b.countBy=function(a,c){return J(a,c,function(a,c){a[c]||(a[c]=0);a[c]++})};b.sortedIndex=function(a,c,d){d||(d=b.identity);for(var c=d(c),e=0,f=a.length;e<f;){var g=e+f>>1;d(a[g])<c?e=g+1:f=g}return e};b.toArray=function(a){return!a?[]:b.isArray(a)||b.isArguments(a)?i.call(a):b.isFunction(a.toArray)?a.toArray():b.values(a)};b.size=function(a){return b.isArray(a)?a.length:b.keys(a).length};b.first=b.head= h,a)});return e};b.groupBy=function(a,c){return J(a,c,function(a,c,b){(a[c]||(a[c]=[])).push(b)})};b.countBy=function(a,c){return J(a,c,function(a,c){a[c]||(a[c]=0);a[c]++})};b.sortedIndex=function(a,c,d){d||(d=b.identity);for(var c=d(c),e=0,f=a.length;e<f;){var g=e+f>>1;d(a[g])<c?e=g+1:f=g}return e};b.toArray=function(a){return!a?[]:b.isArray(a)||b.isArguments(a)?h.call(a):b.isFunction(a.toArray)?a.toArray():b.values(a)};b.size=function(a){return b.isArray(a)?a.length:b.keys(a).length};b.first=b.head=
b.take=function(a,c,b){return c!=null&&!b?i.call(a,0,c):a[0]};b.initial=function(a,c,b){return i.call(a,0,a.length-(c==null||b?1:c))};b.last=function(a,c,b){return c!=null&&!b?i.call(a,Math.max(a.length-c,0)):a[a.length-1]};b.rest=b.tail=function(a,c,b){return i.call(a,c==null||b?1:c)};b.compact=function(a){return b.filter(a,function(a){return!!a})};var n=function(a,c,d){j(a,function(a){b.isArray(a)?c?M.apply(d,a):n(a,c,d):d.push(a)});return d};b.flatten=function(a,c){return n(a,c,[])};b.without= b.take=function(a,c,b){return c!=null&&!b?h.call(a,0,c):a[0]};b.initial=function(a,c,b){return h.call(a,0,a.length-(c==null||b?1:c))};b.last=function(a,c,b){return c!=null&&!b?h.call(a,Math.max(a.length-c,0)):a[a.length-1]};b.rest=b.tail=function(a,c,b){return h.call(a,c==null||b?1:c)};b.compact=function(a){return b.filter(a,function(a){return!!a})};var r=function(a,c,d){i(a,function(a){b.isArray(a)?c?M.apply(d,a):r(a,c,d):d.push(a)});return d};b.flatten=function(a,c){return r(a,c,[])};b.without=
function(a){return b.difference(a,i.call(arguments,1))};b.uniq=b.unique=function(a,c,d){var d=d?b.map(a,d):a,e=[];b.reduce(d,function(d,g,h){if(c?b.last(d)!==g||!d.length:!b.include(d,g)){d.push(g);e.push(a[h])}return d},[]);return e};b.union=function(){return b.uniq(n(arguments,true,[]))};b.intersection=function(a){var c=i.call(arguments,1);return b.filter(b.uniq(a),function(a){return b.every(c,function(c){return b.indexOf(c,a)>=0})})};b.difference=function(a){var c=n(i.call(arguments,1),true,[]); function(a){return b.difference(a,h.call(arguments,1))};b.uniq=b.unique=function(a,c,d){var d=d?b.map(a,d):a,e=[];b.reduce(d,function(d,g,j){if(c?b.last(d)!==g||!d.length:!b.include(d,g)){d.push(g);e.push(a[j])}return d},[]);return e};b.union=function(){return b.uniq(r(arguments,true,[]))};b.intersection=function(a){var c=h.call(arguments,1);return b.filter(b.uniq(a),function(a){return b.every(c,function(c){return b.indexOf(c,a)>=0})})};b.difference=function(a){var c=r(h.call(arguments,1),true,[]);
return b.filter(a,function(a){return!b.include(c,a)})};b.zip=function(){for(var a=i.call(arguments),c=b.max(b.pluck(a,"length")),d=Array(c),e=0;e<c;e++)d[e]=b.pluck(a,""+e);return d};b.zipObject=function(a,c){for(var b={},e=0,f=a.length;e<f;e++)b[a[e]]=c[e];return b};b.indexOf=function(a,c,d){if(a==null)return-1;var e;if(d){d=b.sortedIndex(a,c);return a[d]===c?d:-1}if(r&&a.indexOf===r)return a.indexOf(c);d=0;for(e=a.length;d<e;d++)if(a[d]===c)return d;return-1};b.lastIndexOf=function(a,c){if(a==null)return-1; return b.filter(a,function(a){return!b.include(c,a)})};b.zip=function(){for(var a=h.call(arguments),c=b.max(b.pluck(a,"length")),d=Array(c),e=0;e<c;e++)d[e]=b.pluck(a,""+e);return d};b.zipObject=function(a,c){for(var b={},e=0,f=a.length;e<f;e++)b[a[e]]=c[e];return b};b.indexOf=function(a,c,d){if(a==null)return-1;var e;if(d){d=b.sortedIndex(a,c);return a[d]===c?d:-1}if(q&&a.indexOf===q)return a.indexOf(c);d=0;for(e=a.length;d<e;d++)if(a[d]===c)return d;return-1};b.lastIndexOf=function(a,c){if(a==null)return-1;
if(G&&a.lastIndexOf===G)return a.lastIndexOf(c);for(var b=a.length;b--;)if(a[b]===c)return b;return-1};b.range=function(a,c,b){if(arguments.length<=1){c=a||0;a=0}for(var b=arguments[2]||1,e=Math.max(Math.ceil((c-a)/b),0),f=0,g=Array(e);f<e;){g[f++]=a;a=a+b}return g};var K=function(){};b.bind=function(a,c){var d,e;if(a.bind===t&&t)return t.apply(a,i.call(arguments,1));if(!b.isFunction(a))throw new TypeError;e=i.call(arguments,2);return d=function(){if(!(this instanceof d))return a.apply(c,e.concat(i.call(arguments))); if(G&&a.lastIndexOf===G)return a.lastIndexOf(c);for(var b=a.length;b--;)if(a[b]===c)return b;return-1};b.range=function(a,c,b){if(arguments.length<=1){c=a||0;a=0}for(var b=arguments[2]||1,e=Math.max(Math.ceil((c-a)/b),0),f=0,g=Array(e);f<e;){g[f++]=a;a=a+b}return g};var K=function(){};b.bind=function(a,c){var d,e;if(a.bind===t&&t)return t.apply(a,h.call(arguments,1));if(!b.isFunction(a))throw new TypeError;e=h.call(arguments,2);return d=function(){if(!(this instanceof d))return a.apply(c,e.concat(h.call(arguments)));
K.prototype=a.prototype;var b=new K,g=a.apply(b,e.concat(i.call(arguments)));return Object(g)===g?g:b}};b.bindAll=function(a){var c=i.call(arguments,1);c.length==0&&(c=b.functions(a));j(c,function(c){a[c]=b.bind(a[c],a)});return a};b.memoize=function(a,c){var d={};c||(c=b.identity);return function(){var e=c.apply(this,arguments);return b.has(d,e)?d[e]:d[e]=a.apply(this,arguments)}};b.delay=function(a,c){var b=i.call(arguments,2);return setTimeout(function(){return a.apply(null,b)},c)};b.defer=function(a){return b.delay.apply(b, K.prototype=a.prototype;var b=new K,g=a.apply(b,e.concat(h.call(arguments)));return Object(g)===g?g:b}};b.bindAll=function(a){var c=h.call(arguments,1);c.length==0&&(c=b.functions(a));i(c,function(c){a[c]=b.bind(a[c],a)});return a};b.memoize=function(a,c){var d={};c||(c=b.identity);return function(){var e=c.apply(this,arguments);return b.has(d,e)?d[e]:d[e]=a.apply(this,arguments)}};b.delay=function(a,b){var d=h.call(arguments,2);return setTimeout(function(){return a.apply(null,d)},b)};b.defer=function(a){return b.delay.apply(b,
[a,1].concat(i.call(arguments,1)))};b.throttle=function(a,c){var d,e,f,g,h,i,j=b.debounce(function(){h=g=false},c);return function(){d=this;e=arguments;f||(f=setTimeout(function(){f=null;h&&a.apply(d,e);j()},c));if(g)h=true;else{g=true;i=a.apply(d,e)}j();return i}};b.debounce=function(a,b,d){var e;return function(){var f=this,g=arguments,h=d&&!e;clearTimeout(e);e=setTimeout(function(){e=null;d||a.apply(f,g)},b);h&&a.apply(f,g)}};b.once=function(a){var b=false,d;return function(){if(b)return d;b=true; [a,1].concat(h.call(arguments,1)))};b.throttle=function(a,c){var d,e,f,g,j,h,i=b.debounce(function(){j=g=false},c);return function(){d=this;e=arguments;f||(f=setTimeout(function(){f=null;j&&a.apply(d,e);i()},c));if(g)j=true;else{g=true;h=a.apply(d,e)}i();return h}};b.debounce=function(a,b,d){var e;return function(){var f=this,g=arguments,h=d&&!e;clearTimeout(e);e=setTimeout(function(){e=null;d||a.apply(f,g)},b);h&&a.apply(f,g)}};b.once=function(a){var b=false,d;return function(){if(b)return d;b=true;
return d=a.apply(this,arguments)}};b.wrap=function(a,b){return function(){var d=[a].concat(i.call(arguments,0));return b.apply(this,d)}};b.compose=function(){var a=arguments;return function(){for(var b=arguments,d=a.length-1;d>=0;d--)b=[a[d].apply(this,b)];return b[0]}};b.after=function(a,b){return a<=0?b():function(){if(--a<1)return b.apply(this,arguments)}};b.keys=P||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var c=[],d;for(d in a)b.has(a,d)&&(c[c.length]=d);return c};b.values= return d=a.apply(this,arguments)}};b.wrap=function(a,b){return function(){var d=[a].concat(h.call(arguments,0));return b.apply(this,d)}};b.compose=function(){var a=arguments;return function(){for(var b=arguments,d=a.length-1;d>=0;d--)b=[a[d].apply(this,b)];return b[0]}};b.after=function(a,b){return a<=0?b():function(){if(--a<1)return b.apply(this,arguments)}};b.keys=P||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var c=[],d;for(d in a)b.has(a,d)&&(c[c.length]=d);return c};b.values=
function(a){return b.map(a,b.identity)};b.functions=b.methods=function(a){var c=[],d;for(d in a)b.isFunction(a[d])&&c.push(d);return c.sort()};b.extend=function(a){j(i.call(arguments,1),function(b){for(var d in b)a[d]=b[d]});return a};b.pick=function(a){var b={};j(n(i.call(arguments,1),true,[]),function(d){d in a&&(b[d]=a[d])});return b};b.defaults=function(a){j(i.call(arguments,1),function(b){for(var d in b)a[d]==null&&(a[d]=b[d])});return a};b.clone=function(a){return!b.isObject(a)?a:b.isArray(a)? function(a){return b.map(a,b.identity)};b.functions=b.methods=function(a){var c=[],d;for(d in a)b.isFunction(a[d])&&c.push(d);return c.sort()};b.extend=function(a){i(h.call(arguments,1),function(b){for(var d in b)a[d]=b[d]});return a};b.pick=function(a){var c={},d=b.flatten(h.call(arguments,1));i(d,function(b){b in a&&(c[b]=a[b])});return c};b.omit=function(a){var c={},d=b.flatten(h.call(arguments,1)),e;for(e in a)b.include(d,e)||(c[e]=a[e]);return c};b.defaults=function(a){i(h.call(arguments,1),
a.slice():b.extend({},a)};b.tap=function(a,b){b(a);return a};var u=function(a,c,d){if(a===c)return a!==0||1/a==1/c;if(a==null||c==null)return a===c;if(a._chain)a=a._wrapped;if(c._chain)c=c._wrapped;if(a.isEqual&&b.isFunction(a.isEqual))return a.isEqual(c);if(c.isEqual&&b.isFunction(c.isEqual))return c.isEqual(a);var e=m.call(a);if(e!=m.call(c))return false;switch(e){case "[object String]":return a==""+c;case "[object Number]":return a!=+a?c!=+c:a==0?1/a==1/c:a==+c;case "[object Date]":case "[object Boolean]":return+a== function(b){for(var d in b)a[d]==null&&(a[d]=b[d])});return a};b.clone=function(a){return!b.isObject(a)?a:b.isArray(a)?a.slice():b.extend({},a)};b.tap=function(a,b){b(a);return a};var u=function(a,c,d){if(a===c)return a!==0||1/a==1/c;if(a==null||c==null)return a===c;if(a._chain)a=a._wrapped;if(c._chain)c=c._wrapped;if(a.isEqual&&b.isFunction(a.isEqual))return a.isEqual(c);if(c.isEqual&&b.isFunction(c.isEqual))return c.isEqual(a);var e=m.call(a);if(e!=m.call(c))return false;switch(e){case "[object String]":return a==
+c;case "[object RegExp]":return a.source==c.source&&a.global==c.global&&a.multiline==c.multiline&&a.ignoreCase==c.ignoreCase}if(typeof a!="object"||typeof c!="object")return false;for(var f=d.length;f--;)if(d[f]==a)return true;d.push(a);var f=0,g=true;if(e=="[object Array]"){f=a.length;if(g=f==c.length)for(;f--;)if(!(g=f in a==f in c&&u(a[f],c[f],d)))break}else{if("constructor"in a!="constructor"in c||a.constructor!=c.constructor)return false;for(var h in a)if(b.has(a,h)){f++;if(!(g=b.has(c,h)&& ""+c;case "[object Number]":return a!=+a?c!=+c:a==0?1/a==1/c:a==+c;case "[object Date]":case "[object Boolean]":return+a==+c;case "[object RegExp]":return a.source==c.source&&a.global==c.global&&a.multiline==c.multiline&&a.ignoreCase==c.ignoreCase}if(typeof a!="object"||typeof c!="object")return false;for(var f=d.length;f--;)if(d[f]==a)return true;d.push(a);var f=0,g=true;if(e=="[object Array]"){f=a.length;if(g=f==c.length)for(;f--;)if(!(g=f in a==f in c&&u(a[f],c[f],d)))break}else{if("constructor"in
u(a[h],c[h],d)))break}if(g){for(h in c)if(b.has(c,h)&&!f--)break;g=!f}}d.pop();return g};b.isEqual=function(a,b){return u(a,b,[])};b.isEmpty=function(a){if(a==null)return true;if(b.isArray(a)||b.isString(a))return a.length===0;for(var c in a)if(b.has(a,c))return false;return true};b.isElement=function(a){return!!(a&&a.nodeType==1)};b.isArray=q||function(a){return m.call(a)=="[object Array]"};b.isObject=function(a){return a===Object(a)};j("Arguments,Function,String,Number,Date,RegExp".split(","),function(a){b["is"+ a!="constructor"in c||a.constructor!=c.constructor)return false;for(var h in a)if(b.has(a,h)){f++;if(!(g=b.has(c,h)&&u(a[h],c[h],d)))break}if(g){for(h in c)if(b.has(c,h)&&!f--)break;g=!f}}d.pop();return g};b.isEqual=function(a,b){return u(a,b,[])};b.isEmpty=function(a){if(a==null)return true;if(b.isArray(a)||b.isString(a))return a.length===0;for(var c in a)if(b.has(a,c))return false;return true};b.isElement=function(a){return!!(a&&a.nodeType==1)};b.isArray=p||function(a){return m.call(a)=="[object Array]"};
a]=function(b){return m.call(b)=="[object "+a+"]"}});b.isArguments(arguments)||(b.isArguments=function(a){return!(!a||!b.has(a,"callee"))});b.isFinite=function(a){return b.isNumber(a)&&isFinite(a)};b.isNaN=function(a){return a!==a};b.isBoolean=function(a){return a===true||a===false||m.call(a)=="[object Boolean]"};b.isNull=function(a){return a===null};b.isUndefined=function(a){return a===void 0};b.has=function(a,b){return O.call(a,b)};b.noConflict=function(){s._=L;return this};b.identity=function(a){return a}; b.isObject=function(a){return a===Object(a)};i("Arguments,Function,String,Number,Date,RegExp".split(","),function(a){b["is"+a]=function(b){return m.call(b)=="[object "+a+"]"}});b.isArguments(arguments)||(b.isArguments=function(a){return!(!a||!b.has(a,"callee"))});b.isFinite=function(a){return b.isNumber(a)&&isFinite(a)};b.isNaN=function(a){return a!==a};b.isBoolean=function(a){return a===true||a===false||m.call(a)=="[object Boolean]"};b.isNull=function(a){return a===null};b.isUndefined=function(a){return a===
b.times=function(a,b,d){for(var e=0;e<a;e++)b.call(d,e)};var Q={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","/":"&#x2F;"},R=/[&<>"'\/]/g;b.escape=function(a){return(""+a).replace(R,function(a){return Q[a]})};b.result=function(a,c){if(a==null)return null;var d=a[c];return b.isFunction(d)?d.call(a):d};b.mixin=function(a){j(b.functions(a),function(c){S(c,b[c]=a[c])})};var T=0;b.uniqueId=function(a){var b=T++;return a?a+b:b};b.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g, void 0};b.has=function(a,b){return O.call(a,b)};b.noConflict=function(){s._=L;return this};b.identity=function(a){return a};b.times=function(a,b,d){for(var e=0;e<a;e++)b.call(d,e)};var Q={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","/":"&#x2F;"},R=/[&<>"'\/]/g;b.escape=function(a){return(""+a).replace(R,function(a){return Q[a]})};b.result=function(a,c){if(a==null)return null;var d=a[c];return b.isFunction(d)?d.call(a):d};b.mixin=function(a){i(b.functions(a),function(c){S(c,b[c]=a[c])})};
escape:/<%-([\s\S]+?)%>/g};var v=/.^/,o={"\\":"\\","'":"'",r:"\r",n:"\n",t:"\t",u2028:"\u2028",u2029:"\u2029"},w;for(w in o)o[o[w]]=w;var U=/\\|'|\r|\n|\t|\u2028|\u2029/g,V=/\\(\\|'|r|n|t|u2028|u2029)/g,x=function(a){return a.replace(V,function(a,b){return o[b]})};b.template=function(a,c,d){d=b.defaults(d||{},b.templateSettings);a="__p+='"+a.replace(U,function(a){return"\\"+o[a]}).replace(d.escape||v,function(a,b){return"'+\n((__t=("+x(b)+"))==null?'':_.escape(__t))+\n'"}).replace(d.interpolate|| var T=0;b.uniqueId=function(a){var b=T++;return a?a+b:b};b.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var v=/.^/,n={"\\":"\\","'":"'",r:"\r",n:"\n",t:"\t",u2028:"\u2028",u2029:"\u2029"},w;for(w in n)n[n[w]]=w;var U=/\\|'|\r|\n|\t|\u2028|\u2029/g,V=/\\(\\|'|r|n|t|u2028|u2029)/g,x=function(a){return a.replace(V,function(a,b){return n[b]})};b.template=function(a,c,d){d=b.defaults(d||{},b.templateSettings);a="__p+='"+a.replace(U,function(a){return"\\"+
v,function(a,b){return"'+\n((__t=("+x(b)+"))==null?'':__t)+\n'"}).replace(d.evaluate||v,function(a,b){return"';\n"+x(b)+"\n__p+='"})+"';\n";d.variable||(a="with(obj||{}){\n"+a+"}\n");var a="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'')};\n"+a+"return __p;\n",e=new Function(d.variable||"obj","_",a);if(c)return e(c,b);c=function(a){return e.call(this,a,b)};c.source="function("+(d.variable||"obj")+"){\n"+a+"}";return c};b.chain=function(a){return b(a).chain()}; n[a]}).replace(d.escape||v,function(a,b){return"'+\n((__t=("+x(b)+"))==null?'':_.escape(__t))+\n'"}).replace(d.interpolate||v,function(a,b){return"'+\n((__t=("+x(b)+"))==null?'':__t)+\n'"}).replace(d.evaluate||v,function(a,b){return"';\n"+x(b)+"\n__p+='"})+"';\n";d.variable||(a="with(obj||{}){\n"+a+"}\n");var a="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'')};\n"+a+"return __p;\n",e=new Function(d.variable||"obj","_",a);if(c)return e(c,b);c=function(a){return e.call(this,
var l=function(a){this._wrapped=a};b.prototype=l.prototype;var y=function(a,c){return c?b(a).chain():a},S=function(a,c){l.prototype[a]=function(){var a=i.call(arguments);N.call(a,this._wrapped);return y(c.apply(b,a),this._chain)}};b.mixin(b);j("pop,push,reverse,shift,sort,splice,unshift".split(","),function(a){var b=k[a];l.prototype[a]=function(){var d=this._wrapped;b.apply(d,arguments);(a=="shift"||a=="splice")&&d.length===0&&delete d[0];return y(d,this._chain)}});j(["concat","join","slice"],function(a){var b= a,b)};c.source="function("+(d.variable||"obj")+"){\n"+a+"}";return c};b.chain=function(a){return b(a).chain()};var l=function(a){this._wrapped=a};b.prototype=l.prototype;var y=function(a,c){return c?b(a).chain():a},S=function(a,c){l.prototype[a]=function(){var a=h.call(arguments);N.call(a,this._wrapped);return y(c.apply(b,a),this._chain)}};b.mixin(b);i("pop,push,reverse,shift,sort,splice,unshift".split(","),function(a){var b=k[a];l.prototype[a]=function(){var d=this._wrapped;b.apply(d,arguments);
k[a];l.prototype[a]=function(){return y(b.apply(this._wrapped,arguments),this._chain)}});l.prototype.chain=function(){this._chain=true;return this};l.prototype.value=function(){return this._wrapped}}).call(this); (a=="shift"||a=="splice")&&d.length===0&&delete d[0];return y(d,this._chain)}});i(["concat","join","slice"],function(a){var b=k[a];l.prototype[a]=function(){return y(b.apply(this._wrapped,arguments),this._chain)}});l.prototype.chain=function(){this._chain=true;return this};l.prototype.value=function(){return this._wrapped}}).call(this);

View File

@@ -698,11 +698,22 @@
// Return a copy of the object only containing the whitelisted properties. // Return a copy of the object only containing the whitelisted properties.
_.pick = function(obj) { _.pick = function(obj) {
var result = {}; var copy = {};
each(flatten(slice.call(arguments, 1), true, []), function(key) { var keys = _.flatten(slice.call(arguments, 1));
if (key in obj) result[key] = obj[key]; each(keys, function(key) {
if (key in obj) copy[key] = obj[key];
}); });
return result; return copy;
};
// Return a copy of the object without the blacklisted properties.
_.omit = function(obj) {
var copy = {};
var keys = _.flatten(slice.call(arguments, 1));
for (var key in obj) {
if (!_.include(keys, key)) copy[key] = obj[key];
}
return copy;
}; };
// Fill in a given object with default properties. // Fill in a given object with default properties.