forked from lodash/lodash.com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
95 lines (82 loc) · 6.44 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
---
id: home
title: Lodash
layout: default
---
<section>
{% raw %}
<div class="highlight js intro"><pre><div>_<span class="delimiter method">.</span><span class="name">defaults</span>({ <span class="string">'a'</span>: <span class="numeric">1</span> }<span class="delimiter">,</span> { <span class="string">'a'</span>: <span class="numeric">3</span><span class="delimiter">,</span> <span class="string">'b'</span>: <span class="numeric">2</span> });</div><div><span class="comment">// → { 'a': 1, 'b': 2 }</span></div><div>_<span class="delimiter method">.</span><span class="name">partition</span>([<span class="numeric">1</span><span class="delimiter">,</span> <span class="numeric">2</span><span class="delimiter">,</span> <span class="numeric">3</span><span class="delimiter">,</span> <span class="numeric">4</span>]<span class="delimiter">,</span> n <span class="type">=></span> n % <span class="numeric">2</span>);</div><div><span class="comment">// → [[1, 3], [2, 4]]</span></div></pre></div>
{% endraw %}
</section>
<section>
<p id="social"></p>
</section>
<section>
<h2>Download</h2>
<ul id="download-links">
<li>
<i class="fa fa-download" aria-hidden="true"></i><a href="{{ site.links.raw }}/{{ site.release }}-npm/core.js">Core build</a> (<a href="{{ site.links.raw }}/{{ site.release }}-npm/core.min.js">~4kB gzipped</a>)
</li>
<li>
<i class="fa fa-download" aria-hidden="true"></i><a href="{{ site.links.raw }}/{{ site.release }}-npm/lodash.js">Full build</a> (<a href="{{ site.links.raw }}/{{ site.release }}-npm/lodash.min.js">~24kB gzipped</a>)
</li>
<li>
<i class="fa fa-link" aria-hidden="true"></i><a href="https://www.jsdelivr.com/projects/lodash">CDN copies</a>
</li>
</ul>
<p><span class="rwd-line">Lodash is released under the <a href="{{ site.links.raw }}/{{ site.release }}-npm/LICENSE">MIT license</a> & supports modern environments.</span> <span class="rwd-line">Review the <a href="{{ site.links.build_differences }}">build differences</a> & pick one that’s right for you.</span></p>
</section>
<section>
<h2>Installation</h2>
<p>In a browser:</p>
{% raw %}
<div class="highlight html"><pre><script src=<span class="string">"lodash.js"</span>></script></pre></div>
{% endraw %}
<p>Using npm:</p>
{% raw %}
<div class="highlight shell"><pre><div>$ npm i -g npm</div><div>$ npm i --save lodash</div></pre></div>
{% endraw %}
<p>In Node.js:</p>
{% raw %}
<div class="highlight js"><pre><div><span class="comment">// Load the full build.</span></div><div><span class="type">var</span> _ = <span class="support">require</span>(<span class="string">'lodash'</span>);</div><div><span class="comment">// Load the core build.</span></div><div><span class="type">var</span> _ = <span class="support">require</span>(<span class="string">'lodash/core'</span>);</div><div><span class="comment">// Load the FP build for immutable auto-curried iteratee-first data-last methods.</span></div><div><span class="type">var</span> fp = <span class="support">require</span>(<span class="string">'lodash/fp'</span>);</div><div> </div><div><span class="comment">// Load method categories.</span></div><div><span class="type">var</span> array = <span class="support">require</span>(<span class="string">'lodash/array'</span>);</div><div><span class="type">var</span> object = <span class="support">require</span>(<span class="string">'lodash/fp/object'</span>);</div><div> </div><div><span class="comment">// Cherry-pick methods for smaller browserify/rollup/webpack bundles.</span></div><div><span class="type">var</span> at = <span class="support">require</span>(<span class="string">'lodash/at'</span>);</div><div><span class="type">var</span> curryN = <span class="support">require</span>(<span class="string">'lodash/fp/curryN'</span>);</div></pre></div>
{% endraw %}
<p><strong>Note:</strong><br>Install <a href="https://www.npmjs.com/package/n_">n_</a> for Lodash use in the Node.js < 6 REPL.</p>
</section>
<section>
<h2>Why Lodash?</h2>
<p><span class="rwd-line">Lodash makes JavaScript easier by taking the hassle out of working with arrays, numbers, objects, strings, etc.</span> <span class="rwd-line">Lodash’s modular methods are great for:</span></p>
<ul class="chevron">
<li>Iterating arrays, objects, & strings</li>
<li>Manipulating & testing values</li>
<li>Creating composite functions</li>
</ul>
</section>
<section>
<h2>Module Formats</h2>
<p>Lodash is available in a <a href="/custom-builds">variety of builds</a> & module formats.</p>
<ul class="chevron">
<li><a href="https://www.npmjs.com/package/lodash">lodash</a> & <a href="/per-method-packages">per method packages</a></li>
<li><a href="https://www.npmjs.com/package/lodash-es">lodash-es</a>, <a href="https://www.npmjs.com/package/babel-plugin-lodash">babel-plugin-lodash</a>, & <a href="https://www.npmjs.com/package/lodash-webpack-plugin">lodash-webpack-plugin</a></li>
<li><a href="{{ site.links.repo }}/tree/{{ site.release }}-npm/fp">lodash/fp</a></li>
<li><a href="https://www.npmjs.com/package/lodash-amd">lodash-amd</a></li>
</ul>
</section>
<section>
<h2>Complementary Tools</h2>
<ul class="chevron">
<li><a href="https://github.com/smartprocure/futil-js">futil-js</a> is a set of functional utilities designed to complement lodash</li>
</ul>
</section>
<section>
<h2>Further Reading</h2>
<ul class="chevron">
<li><a href="{{ site.links.repo }}/blob/master/.github/CONTRIBUTING.md">Contributing</a></li>
<li><a href="{{ site.links.repo }}/releases/tag/4.0.0">Release Notes</a></li>
<li><a href="{{ site.links.repo }}/wiki">Wiki (Changelog, Roadmap, etc.)</a></li>
</ul>
</section>
<section>
<h2>Support</h2>
<p><span class="rwd-line">Tested in Chrome 74-75, Firefox 66-67, IE 11, Edge 18, Safari 11-12, & Node.js 8-12.</span></p>
</section>
<script src="/assets/js/home.js" async></script>