PageRenderTime 61ms CodeModel.GetById 29ms RepoModel.GetById 0ms app.codeStats 0ms

/public/app/components/lodash/README.md

https://bitbucket.org/avovsya/contactme
Markdown | 287 lines | 216 code | 71 blank | 0 comment | 0 complexity | f9ef1c89ce76bc96ba067972c9fc77a5 MD5 | raw file
  1. # Lo-Dash <sup>v1.0.0</sup>
  2. [![build status](https://secure.travis-ci.org/bestiejs/lodash.png)](http://travis-ci.org/bestiejs/lodash)
  3. An alternative to Underscore.js, delivering consistency, [customization](https://github.com/bestiejs/lodash#custom-builds), [performance](http://lodash.com/benchmarks), and [extra features](https://github.com/bestiejs/lodash#features).
  4. ## Download
  5. * Lo-Dash builds (for modern environments):<br>
  6. [Development](https://raw.github.com/bestiejs/lodash/v1.0.0/dist/lodash.js) and
  7. [Production](https://raw.github.com/bestiejs/lodash/v1.0.0/dist/lodash.min.js)
  8. * Lo-Dash compatibility builds (for legacy and modern environments):<br>
  9. [Development](https://raw.github.com/bestiejs/lodash/v1.0.0/dist/lodash.compat.js) and
  10. [Production](https://raw.github.com/bestiejs/lodash/v1.0.0/dist/lodash.compat.min.js)
  11. * Underscore compatibility builds:<br>
  12. [Development](https://raw.github.com/bestiejs/lodash/v1.0.0/dist/lodash.underscore.js) and
  13. [Production](https://raw.github.com/bestiejs/lodash/v1.0.0/dist/lodash.underscore.min.js)
  14. * CDN copies of v1.0.0s builds are available on [cdnjs](http://cdnjs.com/) thanks to [CloudFlare](http://www.cloudflare.com/):<br>
  15. [Lo-Dash dev](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.0.0/lodash.js),
  16. [Lo-Dash prod](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.0.0/lodash.min.js),<br>
  17. [Lo-Dash compat-dev](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.0.0/lodash.compat.js),
  18. [Lo-Dash compat-prod](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.0.0/lodash.compat.min.js),<br>
  19. [Underscore compat-dev](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.0.0/lodash.underscore.js), and
  20. [Underscore compat-prod](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.0.0/lodash.underscore.min.js)
  21. * For optimal file size, [create a custom build](https://github.com/bestiejs/lodash#custom-builds) with only the features you need
  22. ## Dive in
  23. Weve got [API docs](http://lodash.com/docs), [benchmarks](http://lodash.com/benchmarks), and [unit tests](http://lodash.com/tests).
  24. For a list of upcoming features, check out our [roadmap](https://github.com/bestiejs/lodash/wiki/Roadmap).
  25. ## Screencasts
  26. For more information check out these screencasts over Lo-Dash:
  27. * [Introducing Lo-Dash](https://vimeo.com/44154599)
  28. * [Lo-Dash optimizations and custom builds](https://vimeo.com/44154601)
  29. * [Lo-Dashs origin and why its a better utility belt](https://vimeo.com/44154600)
  30. * [Unit testing in Lo-Dash](https://vimeo.com/45865290)
  31. * [Lo-Dashs approach to native method use](https://vimeo.com/48576012)
  32. * [CascadiaJS: Lo-Dash for a better utility belt](http://www.youtube.com/watch?v=dpPy4f_SeEk)
  33. ## Features
  34. * AMD loader support ([RequireJS](http://requirejs.org/), [curl.js](https://github.com/cujojs/curl), etc.)
  35. * [_()](http://lodash.com/docs#_) supports intuitive chaining
  36. * [_.at](http://lodash.com/docs#at) for cherry-picking collection values
  37. * [_.bindKey](http://lodash.com/docs#bindKey) for binding [*“lazy”* defined](http://michaux.ca/articles/lazy-function-definition-pattern) methods
  38. * [_.cloneDeep](http://lodash.com/docs#cloneDeep) for deep cloning arrays and objects
  39. * [_.contains](http://lodash.com/docs#contains) accepts a `fromIndex` argument
  40. * [_.forEach](http://lodash.com/docs#forEach) is chainable and supports exiting iteration early
  41. * [_.forIn](http://lodash.com/docs#forIn) for iterating over an object’s own and inherited properties
  42. * [_.forOwn](http://lodash.com/docs#forOwn) for iterating over an object’s own properties
  43. * [_.isPlainObject](http://lodash.com/docs#isPlainObject) checks if values are created by the `Object` constructor
  44. * [_.merge](http://lodash.com/docs#merge) for a deep [_.extend](http://lodash.com/docs#extend)
  45. * [_.partial](http://lodash.com/docs#partial) and [_.partialRight](http://lodash.com/docs#partialRight) for partial application without `this` binding
  46. * [_.template](http://lodash.com/docs#template) supports [*“imports”* options](http://lodash.com/docs#templateSettings_imports), [ES6 template delimiters](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-7.8.6), and [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
  47. * [_.where](http://lodash.com/docs#where) supports deep object comparisons
  48. * [_.clone](http://lodash.com/docs#clone), [_.omit](http://lodash.com/docs#omit), [_.pick](http://lodash.com/docs#pick),
  49. [and more](http://lodash.com/docs "_.assign, _.cloneDeep, _.first, _.initial, _.isEqual, _.last, _.merge, _.rest") accept `callback` and `thisArg` arguments
  50. * [_.contains](http://lodash.com/docs#contains), [_.size](http://lodash.com/docs#size), [_.toArray](http://lodash.com/docs#toArray),
  51. [and more](http://lodash.com/docs "_.at, _.countBy, _.every, _.filter, _.find, _.forEach, _.groupBy, _.invoke, _.map, _.max, _.min, _.pluck, _.reduce, _.reduceRight, _.reject, _.shuffle, _.some, _.sortBy, _.where") accept strings
  52. * [_.filter](http://lodash.com/docs#filter), [_.find](http://lodash.com/docs#find), [_.map](http://lodash.com/docs#map),
  53. [and more](http://lodash.com/docs "_.countBy, _.every, _.first, _.groupBy, _.initial, _.last, _.max, _.min, _.reject, _.rest, _.some, _.sortBy, _.sortedIndex, _.uniq") support *“_.pluck”* and *“_.where”* `callback` shorthands
  54. ## Support
  55. Lo-Dash has been tested in at least Chrome 5~24, Firefox 1~18, IE 6-10, Opera 9.25-12, Safari 3-6, Node.js 0.4.8-0.8.19, Narwhal 0.3.2, PhantomJS 1.8.1, RingoJS 0.9, and Rhino 1.7RC5.
  56. ## Custom builds
  57. Custom builds make it easy to create lightweight versions of Lo-Dash containing only the methods you need.
  58. To top it off, we handle all method dependency and alias mapping for you.
  59. * Backbone builds, with only methods required by Backbone, may be created using the `backbone` modifier argument.
  60. ```bash
  61. lodash backbone
  62. ```
  63. * CSP builds, supporting default [Content Security Policy](https://dvcs.w3.org/hg/content-security-policy/raw-file/tip/csp-specification.dev.html) restrictions, may be created using the `csp` modifier argument.
  64. The `csp` modifier is an alais of the `mobile` modifier. Lo-Dash may be used in Chrome extensions by using either the `csp`, `mobile`, or `underscore` build and using precompiled templates, or loading Lo-Dash in a [sandbox](http://developer.chrome.com/stable/extensions/sandboxingEval.html).
  65. ```bash
  66. lodash csp
  67. ```
  68. * Legacy builds, tailored for older environments without [ES5 support](http://es5.github.com/), may be created using the `legacy` modifier argument.
  69. ```bash
  70. lodash legacy
  71. ```
  72. * Modern builds, tailored for newer environments with ES5 support, may be created using the `modern` modifier argument.
  73. ```bash
  74. lodash modern
  75. ```
  76. * Mobile builds, without method compilation and most bug fixes for old browsers, may be created using the `mobile` modifier argument.
  77. ```bash
  78. lodash mobile
  79. ```
  80. * Strict builds, with `_.bindAll`, `_.defaults`, and `_.extend` in [strict mode](http://es5.github.com/#C), may be created using the `strict` modifier argument.
  81. ```bash
  82. lodash strict
  83. ```
  84. * Underscore builds, tailored for projects already using Underscore, may be created using the `underscore` modifier argument.
  85. ```bash
  86. lodash underscore
  87. ```
  88. Custom builds may be created using the following commands:
  89. * Use the `category` argument to pass comma separated categories of methods to include in the build.<br>
  90. Valid categories (case-insensitive) are *arrays*, *chaining*, *collections*, *functions*, *objects*, and *utilities*.
  91. ```bash
  92. lodash category=collections,functions
  93. lodash category="collections, functions"
  94. ```
  95. * Use the `exports` argument to pass comma separated names of ways to export the `LoDash` function.<br>
  96. Valid exports are *amd*, *commonjs*, *global*, *node*, and *none*.
  97. ```bash
  98. lodash exports=amd,commonjs,node
  99. lodash exports="amd, commonjs, node"
  100. ```
  101. * Use the `iife` argument to specify code to replace the immediately-invoked function expression that wraps Lo-Dash.
  102. ```bash
  103. lodash iife="!function(window,undefined){%output%}(this)"
  104. ```
  105. * Use the `include` argument to pass comma separated method/category names to include in the build.
  106. ```bash
  107. lodash include=each,filter,map
  108. lodash include="each, filter, map"
  109. ```
  110. * Use the `minus` argument to pass comma separated method/category names to remove from those included in the build.
  111. ```bash
  112. lodash underscore minus=result,shuffle
  113. lodash underscore minus="result, shuffle"
  114. ```
  115. * Use the `plus` argument to pass comma separated method/category names to add to those included in the build.
  116. ```bash
  117. lodash backbone plus=random,template
  118. lodash backbone plus="random, template"
  119. ```
  120. * Use the `template` argument to pass the file path pattern used to match template files to precompile.
  121. ```bash
  122. lodash template="./*.jst"
  123. ```
  124. * Use the `settings` argument to pass the template settings used when precompiling templates.
  125. ```bash
  126. lodash settings="{interpolate:/\{\{([\s\S]+?)\}\}/g}"
  127. ```
  128. * Use the `moduleId` argument to specify the AMD module ID of Lo-Dash, which defaults to lodash, used by precompiled templates.
  129. ```bash
  130. lodash moduleId="underscore"
  131. ```
  132. All arguments, except `legacy` with `csp`, `mobile`, `modern`, or `underscore`, may be combined.<br>
  133. Unless specified by `-o` or `--output`, all files created are saved to the current working directory.
  134. The following options are also supported:
  135. * `-c`, `--stdout` ......... Write output to standard output
  136. * `-d`, `--debug` ........... Write only the non-minified development output
  137. * `-h`, `--help` ............. Display help information
  138. * `-m`, `--minify` ......... Write only the minified production output
  139. * `-o`, `--output` ......... Write output to a given path/filename
  140. * `-p`, `--source-map` .. Generate a source map for the minified output
  141. * `-s`, `--silent` ......... Skip status updates normally logged to the console
  142. * `-V`, `--version` ....... Output current version of Lo-Dash
  143. The `lodash` command-line utility is available when Lo-Dash is installed as a global package (i.e. `npm install -g lodash`).
  144. ## Installation and usage
  145. In browsers:
  146. ```html
  147. <script src="lodash.js"></script>
  148. ```
  149. Using [`npm`](http://npmjs.org/):
  150. ```bash
  151. npm install lodash
  152. npm install -g lodash
  153. npm link lodash
  154. ```
  155. To avoid potential issues, update `npm` before installing Lo-Dash:
  156. ```bash
  157. npm install npm -g
  158. ```
  159. In [Node.js](http://nodejs.org/) and [RingoJS v0.8.0+](http://ringojs.org/):
  160. ```js
  161. var _ = require('lodash');
  162. // or as a drop-in replacement for Underscore
  163. var _ = require('lodash/lodash.underscore');
  164. ```
  165. **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.
  166. In [RingoJS v0.7.0-](http://ringojs.org/):
  167. ```js
  168. var _ = require('lodash')._;
  169. ```
  170. In [Rhino](http://www.mozilla.org/rhino/):
  171. ```js
  172. load('lodash.js');
  173. ```
  174. In an AMD loader like [RequireJS](http://requirejs.org/):
  175. ```js
  176. require({
  177. 'paths': {
  178. 'underscore': 'path/to/lodash'
  179. }
  180. },
  181. ['underscore'], function(_) {
  182. console.log(_.VERSION);
  183. });
  184. ```
  185. ## Release Notes
  186. ### <sup>v1.0.0</sup>
  187. #### Compatibility Warnings
  188. * Made `_.defaults` preserve `null` values, instead of overwriting them
  189. #### Changes
  190. * Added [_.at](http://lodash.com/docs#at) and [_.partialRight](http://lodash.com/docs#partialRight)
  191. * Added [*imports*](http://lodash.com/docs#templateSettings_imports) option to `_.templateSettings`
  192. * Added `modern` and `--source-map`/`-p` build options
  193. * Added support for *_.pluck* and *_.where* `callback` shorthands
  194. * Ensured `_.assign` and `_.defaults` support arrays
  195. * Ensured `_.merge` assigns `null` values and produces dense arrays
  196. * Deferred minifier downloads until the `lodash` utility requires them
  197. * Flipped `noNodeClass` test to avoid triggering Firebugs *break on all errors* feature
  198. * Made `_.where` support deep object comparisons
  199. * Optimized `_.invert`, `_.pairs`, and `_.values`
  200. * Reduced `_.max`, `_.min`, `_.pluck`, `_.toArray`, and `_.where`
  201. * Simplified `createIterator` and `iteratorTemplate`
  202. * Tweaked `_.uniqueId` to avoid problems with buggy minifiers
  203. * Updated `underscore` build compatibility to v1.4.4
  204. * Added support for `callback` and `thisArg` arguments to `_.assign`, `_.clone`,<br>
  205. `_.cloneDeep`, `_.first`, `_.last`, `_.initial`, `_.isEqual`, `_.merge`, and `_.rest`
  206. The full changelog is available [here](https://github.com/bestiejs/lodash/wiki/Changelog).
  207. ## BestieJS
  208. 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.
  209. ## Author
  210. * [John-David Dalton](http://allyoucanleet.com/)
  211. [![twitter/jdalton](http://gravatar.com/avatar/299a3d891ff1920b69c364d061007043?s=70)](https://twitter.com/jdalton "Follow @jdalton on Twitter")
  212. ## Contributors
  213. * [Kit Cambridge](http://kitcambridge.github.com/)
  214. [![twitter/kitcambridge](http://gravatar.com/avatar/6662a1d02f351b5ef2f8b4d815804661?s=70)](https://twitter.com/kitcambridge "Follow @kitcambridge on Twitter")
  215. * [Mathias Bynens](http://mathiasbynens.be/)
  216. [![twitter/mathias](http://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](https://twitter.com/mathias "Follow @mathias on Twitter")