mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 18:17:48 +00:00
README: Switch to the triple backtick syntax for highlighted code blocks
Former-commit-id: c4fba0c9cf7e8b0fdfc846260b148ecd327c0a1f
This commit is contained in:
64
README.md
64
README.md
@@ -59,62 +59,62 @@ Custom builds make it easy to create lightweight versions of Lo-Dash containing
|
|||||||
We handle all the method dependency and alias mapping for you.
|
We handle all the method dependency and alias mapping for you.
|
||||||
|
|
||||||
* Backbone builds, containing all methods required by Backbone, may be created using the `backbone` modifier argument.
|
* Backbone builds, containing all methods required by Backbone, may be created using the `backbone` modifier argument.
|
||||||
~~~ bash
|
```bash
|
||||||
lodash backbone
|
lodash backbone
|
||||||
~~~
|
```
|
||||||
|
|
||||||
* CSP builds, supporting default Content Security Policy restrictions, may be created using the `csp` modifier argument.
|
* CSP builds, supporting default Content Security Policy restrictions, may be created using the `csp` modifier argument.
|
||||||
~~~ bash
|
```bash
|
||||||
lodash csp
|
lodash csp
|
||||||
~~~
|
```
|
||||||
|
|
||||||
* Legacy builds, tailored for older browsers without [ES5 support](http://es5.github.com/), may be created using the `legacy` modifier argument.
|
* Legacy builds, tailored for older browsers without [ES5 support](http://es5.github.com/), may be created using the `legacy` modifier argument.
|
||||||
~~~ bash
|
```bash
|
||||||
lodash legacy
|
lodash legacy
|
||||||
~~~
|
```
|
||||||
|
|
||||||
* Mobile builds, with IE < 9 bug fixes and method compilation removed, may be created using the `mobile` modifier argument.
|
* Mobile builds, with IE < 9 bug fixes and method compilation removed, may be created using the `mobile` modifier argument.
|
||||||
~~~ bash
|
```bash
|
||||||
lodash mobile
|
lodash mobile
|
||||||
~~~
|
```
|
||||||
|
|
||||||
* Strict builds, with `_.bindAll`, `_.defaults`, and `_.extend` in [strict mode](http://es5.github.com/#C), may be created using the `strict` modifier argument.
|
* Strict builds, with `_.bindAll`, `_.defaults`, and `_.extend` in [strict mode](http://es5.github.com/#C), may be created using the `strict` modifier argument.
|
||||||
~~~ bash
|
```bash
|
||||||
lodash strict
|
lodash strict
|
||||||
~~~
|
```
|
||||||
|
|
||||||
* Underscore builds, containing only methods included in Underscore, may be created using the `underscore` modifier argument.
|
* Underscore builds, containing only methods included in Underscore, may be created using the `underscore` modifier argument.
|
||||||
~~~ bash
|
```bash
|
||||||
lodash underscore
|
lodash underscore
|
||||||
~~~
|
```
|
||||||
|
|
||||||
Custom builds may be created in three ways:
|
Custom builds may be created in three ways:
|
||||||
|
|
||||||
1. Use the `category` argument to pass the categories of methods to include in the build.<br>
|
1. Use the `category` argument to pass the categories of methods to include in the build.<br>
|
||||||
Valid categories are *"arrays"*, *"chaining"*, *"collections"*, *"functions"*, *"objects"*, and *"utilities"*.
|
Valid categories are *"arrays"*, *"chaining"*, *"collections"*, *"functions"*, *"objects"*, and *"utilities"*.
|
||||||
~~~ bash
|
```bash
|
||||||
lodash category=collections,functions
|
lodash category=collections,functions
|
||||||
lodash category="collections, functions"
|
lodash category="collections, functions"
|
||||||
~~~
|
```
|
||||||
|
|
||||||
2. Use the `exclude` argument to pass the names of methods to exclude from the build.
|
2. Use the `exclude` argument to pass the names of methods to exclude from the build.
|
||||||
~~~ bash
|
```bash
|
||||||
lodash exclude=union,uniq,zip
|
lodash exclude=union,uniq,zip
|
||||||
lodash exclude="union, uniq, zip"
|
lodash exclude="union, uniq, zip"
|
||||||
~~~
|
```
|
||||||
|
|
||||||
3. Use the `include` argument to pass the names of methods to include in the build.
|
3. Use the `include` argument to pass the names of methods to include in the build.
|
||||||
~~~ bash
|
```bash
|
||||||
lodash include=each,filter,map
|
lodash include=each,filter,map
|
||||||
lodash include="each, filter, map"
|
lodash include="each, filter, map"
|
||||||
~~~
|
```
|
||||||
|
|
||||||
All arguments, except `backbone` with `underscore`, `exclude` with `include`, and `legacy` with `csp`/`mobile`, may be combined.
|
All arguments, except `backbone` with `underscore`, `exclude` with `include`, and `legacy` with `csp`/`mobile`, may be combined.
|
||||||
|
|
||||||
~~~ bash
|
```bash
|
||||||
lodash backbone legacy category=utilities exclude=first,last
|
lodash backbone legacy category=utilities exclude=first,last
|
||||||
lodash underscore mobile strict category=functions include=pick,uniq
|
lodash underscore mobile strict category=functions include=pick,uniq
|
||||||
~~~
|
```
|
||||||
|
|
||||||
The `lodash` command-line utility is available when Lo-Dash is installed as a global package (i.e. `npm install -g lodash`).
|
The `lodash` command-line utility is available when Lo-Dash is installed as a global package (i.e. `npm install -g lodash`).
|
||||||
|
|
||||||
@@ -124,38 +124,38 @@ Custom builds are saved to `lodash.custom.js` and `lodash.custom.min.js`.
|
|||||||
|
|
||||||
In browsers:
|
In browsers:
|
||||||
|
|
||||||
~~~ html
|
```html
|
||||||
<script src="lodash.js"></script>
|
<script src="lodash.js"></script>
|
||||||
~~~
|
```
|
||||||
|
|
||||||
Using [npm](http://npmjs.org/):
|
Using [npm](http://npmjs.org/):
|
||||||
|
|
||||||
~~~ bash
|
```bash
|
||||||
npm install lodash
|
npm install lodash
|
||||||
npm install -g lodash
|
npm install -g lodash
|
||||||
~~~
|
```
|
||||||
|
|
||||||
In [Node.js](http://nodejs.org/) and [RingoJS v0.8.0+](http://ringojs.org/):
|
In [Node.js](http://nodejs.org/) and [RingoJS v0.8.0+](http://ringojs.org/):
|
||||||
|
|
||||||
~~~ js
|
```js
|
||||||
var _ = require('lodash');
|
var _ = require('lodash');
|
||||||
~~~
|
```
|
||||||
|
|
||||||
In [RingoJS v0.7.0-](http://ringojs.org/):
|
In [RingoJS v0.7.0-](http://ringojs.org/):
|
||||||
|
|
||||||
~~~ js
|
```js
|
||||||
var _ = require('lodash')._;
|
var _ = require('lodash')._;
|
||||||
~~~
|
```
|
||||||
|
|
||||||
In [Rhino](http://www.mozilla.org/rhino/):
|
In [Rhino](http://www.mozilla.org/rhino/):
|
||||||
|
|
||||||
~~~ js
|
```js
|
||||||
load('lodash.js');
|
load('lodash.js');
|
||||||
~~~
|
```
|
||||||
|
|
||||||
In an AMD loader like [RequireJS](http://requirejs.org/):
|
In an AMD loader like [RequireJS](http://requirejs.org/):
|
||||||
|
|
||||||
~~~ js
|
```js
|
||||||
require({
|
require({
|
||||||
'paths': {
|
'paths': {
|
||||||
'underscore': 'path/to/lodash'
|
'underscore': 'path/to/lodash'
|
||||||
@@ -164,7 +164,7 @@ require({
|
|||||||
['underscore'], function(_) {
|
['underscore'], function(_) {
|
||||||
console.log(_.VERSION);
|
console.log(_.VERSION);
|
||||||
});
|
});
|
||||||
~~~
|
```
|
||||||
|
|
||||||
## Resolved Underscore.js issues <sup>(20+)</sup>
|
## Resolved Underscore.js issues <sup>(20+)</sup>
|
||||||
|
|
||||||
|
|||||||
360
doc/README.md
360
doc/README.md
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user