PageRenderTime 56ms CodeModel.GetById 26ms RepoModel.GetById 0ms app.codeStats 0ms

/node_modules/grunt/node_modules/lodash/README.md

https://bitbucket.org/biojazzard/gantry-eboracast
Markdown | 247 lines | 183 code | 64 blank | 0 comment | 0 complexity | 7bb2878ee1e4f37d1566a3e3ebaedee5 MD5 | raw file
Possible License(s): MIT, JSON, BSD-2-Clause, Unlicense, GPL-2.0, WTFPL, LGPL-3.0, Apache-2.0, 0BSD, BSD-3-Clause, CC-BY-SA-3.0
  1. # Lo-Dash <sup>v0.9.2</sup>
  2. [![build status](https://secure.travis-ci.org/bestiejs/lodash.png)](http://travis-ci.org/bestiejs/lodash)
  3. 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), and [additional features](http://lodash.com/#features).
  4. Lo-Dashs performance is gained by avoiding slower native methods, instead opting for simplified non-ES5 compliant methods optimized for common usage, and by leveraging function compilation to reduce the number of overall function calls.
  5. ## Download
  6. * [Development build](https://raw.github.com/bestiejs/lodash/v0.9.2/lodash.js)
  7. * [Production build](https://raw.github.com/bestiejs/lodash/v0.9.2/lodash.min.js)
  8. * [Underscore build](https://raw.github.com/bestiejs/lodash/v0.9.2/lodash.underscore.min.js) tailored for projects already using Underscore
  9. * CDN copies of v0.9.2s [Production](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/0.9.2/lodash.min.js), [Underscore](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/0.9.2/lodash.underscore.min.js), and [Development](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/0.9.2/lodash.js) builds are available on [cdnjs](http://cdnjs.com/) thanks to [CloudFlare](http://www.cloudflare.com/)
  10. * For optimal file size, [create a custom build](https://github.com/bestiejs/lodash#custom-builds) with only the features you need
  11. ## Dive in
  12. Weve got [API docs](http://lodash.com/docs), [benchmarks](http://lodash.com/benchmarks), and [unit tests](http://lodash.com/tests).
  13. Create your own benchmarks at [jsPerf](http://jsperf.com), or [search](http://jsperf.com/search?q=lodash) for existing ones.
  14. For a list of upcoming features, check out our [roadmap](https://github.com/bestiejs/lodash/wiki/Roadmap).
  15. ## Screencasts
  16. For more information check out these screencasts over Lo-Dash:
  17. * [Introducing Lo-Dash](https://vimeo.com/44154599)
  18. * [Lo-Dash optimizations and custom builds](https://vimeo.com/44154601)
  19. * [Lo-Dashs origin and why its a better utility belt](https://vimeo.com/44154600)
  20. * [Unit testing in Lo-Dash](https://vimeo.com/45865290)
  21. * [Lo-Dashs approach to native method use](https://vimeo.com/48576012)
  22. ## Features
  23. * AMD loader support ([RequireJS](http://requirejs.org/), [curl.js](https://github.com/cujojs/curl), etc.)
  24. * [_.clone](http://lodash.com/docs#clone) supports *“deep”* cloning
  25. * [_.contains](http://lodash.com/docs#contains) accepts a `fromIndex` argument
  26. * [_.forEach](http://lodash.com/docs#forEach) is chainable and supports exiting iteration early
  27. * [_.forIn](http://lodash.com/docs#forIn) for iterating over an object’s own and inherited properties
  28. * [_.forOwn](http://lodash.com/docs#forOwn) for iterating over an object’s own properties
  29. * [_.isPlainObject](http://lodash.com/docs#isPlainObject) checks if values are created by the `Object` constructor
  30. * [_.lateBind](http://lodash.com/docs#lateBind) for late binding
  31. * [_.merge](http://lodash.com/docs#merge) for a *“deep”* [_.extend](http://lodash.com/docs#extend)
  32. * [_.partial](http://lodash.com/docs#partial) for partial application without `this` binding
  33. * [_.pick](http://lodash.com/docs#pick) and [_.omit](http://lodash.com/docs#omit) accepts `callback` and `thisArg` arguments
  34. * [_.template](http://lodash.com/docs#template) supports [ES6 delimiters](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-7.8.6) and utilizes [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl) for easier debugging
  35. * [_.contains](http://lodash.com/docs#contains), [_.size](http://lodash.com/docs#size), [_.toArray](http://lodash.com/docs#toArray),
  36. [and more](http://lodash.com/docs "_.countBy, _.every, _.filter, _.find, _.forEach, _.groupBy, _.invoke, _.map, _.max, _.min, _.pluck, _.reduce, _.reduceRight, _.reject, _.shuffle, _.some, _.sortBy, _.where") accept strings
  37. ## Support
  38. Lo-Dash has been tested in at least Chrome 5~23, Firefox 1~16, IE 6-10, Opera 9.25-12, Safari 3-6, Node.js 0.4.8-0.8.14, Narwhal 0.3.2, RingoJS 0.8, and Rhino 1.7RC5.
  39. ## Custom builds
  40. Custom builds make it easy to create lightweight versions of Lo-Dash containing only the methods you need.
  41. To top it off, we handle all method dependency and alias mapping for you.
  42. * Backbone builds, with only methods required by Backbone, may be created using the `backbone` modifier argument.
  43. ```bash
  44. lodash backbone
  45. ```
  46. * CSP builds, supporting default Content Security Policy restrictions, may be created using the `csp` modifier argument.
  47. ```bash
  48. lodash csp
  49. ```
  50. * Legacy builds, tailored for older browsers without [ES5 support](http://es5.github.com/), may be created using the `legacy` modifier argument.
  51. ```bash
  52. lodash legacy
  53. ```
  54. * Mobile builds, with IE < 9 bug fixes and method compilation removed, may be created using the `mobile` modifier argument.
  55. ```bash
  56. lodash mobile
  57. ```
  58. * Strict builds, with `_.bindAll`, `_.defaults`, and `_.extend` in [strict mode](http://es5.github.com/#C), may be created using the `strict` modifier argument.
  59. ```bash
  60. lodash strict
  61. ```
  62. * Underscore builds, tailored for projects already using Underscore, may be created using the `underscore` modifier argument.
  63. ```bash
  64. lodash underscore
  65. ```
  66. Custom builds may be created using the following commands:
  67. * Use the `category` argument to pass comma separated categories of methods to include in the build.<br>
  68. Valid categories (case-insensitive) are *arrays*, *chaining*, *collections*, *functions*, *objects*, and *utilities*.
  69. ```bash
  70. lodash category=collections,functions
  71. lodash category="collections, functions"
  72. ```
  73. * Use the `exports` argument to pass comma separated names of ways to export the `LoDash` function.<br>
  74. Valid exports are *amd*, *commonjs*, *global*, *node*, and *none*.
  75. ```bash
  76. lodash exports=amd,commonjs,node
  77. lodash exports="amd, commonjs, node"
  78. ```
  79. * Use the `iife` argument to specify code to replace the immediately-invoked function expression that wraps Lo-Dash.
  80. ```bash
  81. lodash iife="!function(window,undefined){%output%}(this)"
  82. ```
  83. * Use the `include` argument to pass comma separated method/category names to include in the build.
  84. ```bash
  85. lodash include=each,filter,map
  86. lodash include="each, filter, map"
  87. ```
  88. * Use the `minus` argument to pass comma separated method/category names to remove from those included in the build.
  89. ```bash
  90. lodash underscore minus=result,shuffle
  91. lodash underscore minus="result, shuffle"
  92. ```
  93. * Use the `plus` argument to pass comma separated method/category names to add to those included in the build.
  94. ```bash
  95. lodash backbone plus=random,template
  96. lodash backbone plus="random, template"
  97. ```
  98. * Use the `template` argument to pass the file path pattern used to match template files to precompile.
  99. ```bash
  100. lodash template="./*.jst"
  101. ```
  102. * Use the `settings` argument to pass the template settings used when precompiling templates.
  103. ```bash
  104. lodash settings="{interpolate:/\\{\\{([\\s\\S]+?)\\}\\}/g}"
  105. ```
  106. * Use the `moduleId` argument to specify the AMD module ID of Lo-Dash, which defaults to lodash, used by precompiled templates.
  107. ```bash
  108. lodash moduleId="underscore"
  109. ```
  110. All arguments, except `legacy` with `csp` or `mobile`, may be combined.<br>
  111. Unless specified by `-o` or `--output`, all files created are saved to the current working directory.
  112. The following options are also supported:
  113. * `-c`, `--stdout`&nbsp;&nbsp;&nbsp;&nbsp; Write output to standard output
  114. * `-d`, `--debug`&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Write only the debug output
  115. * `-h`, `--help`&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Display help information
  116. * `-m`, `--minify`&nbsp;&nbsp;&nbsp;&nbsp; Write only the minified output
  117. * `-o`, `--output`&nbsp;&nbsp;&nbsp;&nbsp; Write output to a given path/filename
  118. * `-s`, `--silent`&nbsp;&nbsp;&nbsp;&nbsp; Skip status updates normally logged to the console
  119. * `-V`, `--version`&nbsp;&nbsp; Output current version of Lo-Dash
  120. The `lodash` command-line utility is available when Lo-Dash is installed as a global package (i.e. `npm install -g lodash`).
  121. ## Installation and usage
  122. In browsers:
  123. ```html
  124. <script src="lodash.js"></script>
  125. ```
  126. Using [npm](http://npmjs.org/):
  127. ```bash
  128. npm install lodash
  129. npm install -g lodash
  130. npm link lodash
  131. ```
  132. In [Node.js](http://nodejs.org/) and [RingoJS v0.8.0+](http://ringojs.org/):
  133. ```js
  134. var _ = require('lodash');
  135. ```
  136. **Note:** If Lo-Dash is installed globally, [run `npm link lodash`](http://blog.nodejs.org/2011/03/23/npm-1-0-global-vs-local-installation/) in your project’s root directory before requiring it.
  137. In [RingoJS v0.7.0-](http://ringojs.org/):
  138. ```js
  139. var _ = require('lodash')._;
  140. ```
  141. In [Rhino](http://www.mozilla.org/rhino/):
  142. ```js
  143. load('lodash.js');
  144. ```
  145. In an AMD loader like [RequireJS](http://requirejs.org/):
  146. ```js
  147. require({
  148. 'paths': {
  149. 'underscore': 'path/to/lodash'
  150. }
  151. },
  152. ['underscore'], function(_) {
  153. console.log(_.VERSION);
  154. });
  155. ```
  156. ## Resolved Underscore.js issues
  157. * Allow iteration of objects with a `length` property [[#799](https://github.com/documentcloud/underscore/pull/799), [test](https://github.com/bestiejs/lodash/blob/v0.9.2/test/test.js#L545-551)]
  158. * 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.9.2/test/test.js#L558-582)]
  159. * Methods should work on pages with incorrectly shimmed native methods [[#7](https://github.com/documentcloud/underscore/issues/7), [#742](https://github.com/documentcloud/underscore/issues/742), [test](https://github.com/bestiejs/lodash/blob/v0.9.2/test/test.js#L140-146)]
  160. * `_.isEmpty` should support jQuery/MooTools DOM query collections [[#690](https://github.com/documentcloud/underscore/pull/690), [test](https://github.com/bestiejs/lodash/blob/v0.9.2/test/test.js#L747-752)]
  161. * `_.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.9.2/test/test.js#L828-840)]
  162. * `_.keys` should work with `arguments` objects cross-browser [[#396](https://github.com/documentcloud/underscore/issues/396), [test](https://github.com/bestiejs/lodash/blob/v0.9.2/test/test.js#L921-923)]
  163. * `_.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.9.2/test/test.js#L1337-1340)]
  164. ## Release Notes
  165. ### <sup>v0.9.2</sup>
  166. * Added `fromIndex` argument to `_.contains`
  167. * Added `moduleId` build option
  168. * Added Closure Compiler *simple* optimizations to the build process
  169. * Added support for strings in `_.max` and `_.min`
  170. * Added support for ES6 template delimiters to `_.template`
  171. * Ensured re-minification of Lo-Dash by third parties avoids Closure Compiler bugs
  172. * Optimized `_.every`, `_.find`, `_.some`, and `_.uniq`
  173. The full changelog is available [here](https://github.com/bestiejs/lodash/wiki/Changelog).
  174. ## BestieJS
  175. Lo-Dash is part of the BestieJS *Best in Class* module collection. This means we promote solid browser/environment support, ES5 precedents, unit testing, and plenty of documentation.
  176. ## Author
  177. * [John-David Dalton](http://allyoucanleet.com/)
  178. [![twitter/jdalton](http://gravatar.com/avatar/299a3d891ff1920b69c364d061007043?s=70)](https://twitter.com/jdalton "Follow @jdalton on Twitter")
  179. ## Contributors
  180. * [Kit Cambridge](http://kitcambridge.github.com/)
  181. [![twitter/kitcambridge](http://gravatar.com/avatar/6662a1d02f351b5ef2f8b4d815804661?s=70)](https://twitter.com/kitcambridge "Follow @kitcambridge on Twitter")
  182. * [Mathias Bynens](http://mathiasbynens.be/)
  183. [![twitter/mathias](http://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](https://twitter.com/mathias "Follow @mathias on Twitter")