Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/modules/_collectNonEnumProps.html
Original file line number Diff line number Diff line change
Expand Up @@ -873,7 +873,7 @@ <h1>_collectNonEnumProps.js</h1>
<span class="hljs-keyword">var</span> hash = {};
<span class="hljs-keyword">for</span> (<span class="hljs-keyword">var</span> l = keys.length, i = <span class="hljs-number">0</span>; i &lt; l; ++i) hash[keys[i]] = <span class="hljs-literal">true</span>;
<span class="hljs-keyword">return</span> {
<span class="hljs-attr">contains</span>: <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">key</span>) </span>{ <span class="hljs-keyword">return</span> hash[key]; },
<span class="hljs-attr">contains</span>: <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">key</span>) </span>{ <span class="hljs-keyword">return</span> hash[key] === <span class="hljs-literal">true</span>; },
<span class="hljs-attr">push</span>: <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">key</span>) </span>{
hash[key] = <span class="hljs-literal">true</span>;
<span class="hljs-keyword">return</span> keys.push(key);
Expand Down
2 changes: 1 addition & 1 deletion docs/modules/_setup.html
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,7 @@ <h1>_setup.js</h1>

</div>

<div class="content"><div class='highlight'><pre><span class="hljs-keyword">export</span> <span class="hljs-keyword">var</span> VERSION = <span class="hljs-string">'1.13.1'</span>;</pre></div></div>
<div class="content"><div class='highlight'><pre><span class="hljs-keyword">export</span> <span class="hljs-keyword">var</span> VERSION = <span class="hljs-string">'1.13.2'</span>;</pre></div></div>

</li>

Expand Down
2 changes: 1 addition & 1 deletion docs/modules/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,7 @@ <h1 id="named-exports">Named Exports</h1>
<div class="pilwrap ">
<a class="pilcrow" href="#section-3">&#182;</a>
</div>
<pre><code>Underscore.js <span class="hljs-number">1.13</span><span class="hljs-number">.1</span>
<pre><code>Underscore.js <span class="hljs-number">1.13</span><span class="hljs-number">.2</span>
<span class="hljs-attr">https</span>:<span class="hljs-comment">//underscorejs.org</span>
(c) <span class="hljs-number">2009</span><span class="hljs-number">-2021</span> Jeremy Ashkenas, Julian Gonggrijp, and DocumentCloud and Investigative Reporters &amp; Editors
Underscore may be freely distributed under the MIT license.</code></pre>
Expand Down
6 changes: 3 additions & 3 deletions docs/modules/sample.html
Original file line number Diff line number Diff line change
Expand Up @@ -850,10 +850,10 @@ <h1>sample.js</h1>
</div>

<div class="content"><div class='highlight'><pre><span class="hljs-keyword">import</span> isArrayLike <span class="hljs-keyword">from</span> <span class="hljs-string">'./_isArrayLike.js'</span>;
<span class="hljs-keyword">import</span> clone <span class="hljs-keyword">from</span> <span class="hljs-string">'./clone.js'</span>;
<span class="hljs-keyword">import</span> values <span class="hljs-keyword">from</span> <span class="hljs-string">'./values.js'</span>;
<span class="hljs-keyword">import</span> getLength <span class="hljs-keyword">from</span> <span class="hljs-string">'./_getLength.js'</span>;
<span class="hljs-keyword">import</span> random <span class="hljs-keyword">from</span> <span class="hljs-string">'./random.js'</span>;</pre></div></div>
<span class="hljs-keyword">import</span> random <span class="hljs-keyword">from</span> <span class="hljs-string">'./random.js'</span>;
<span class="hljs-keyword">import</span> toArray <span class="hljs-keyword">from</span> <span class="hljs-string">'./toArray.js'</span>;</pre></div></div>

</li>

Expand All @@ -876,7 +876,7 @@ <h1>sample.js</h1>
<span class="hljs-keyword">if</span> (!isArrayLike(obj)) obj = values(obj);
<span class="hljs-keyword">return</span> obj[random(obj.length - <span class="hljs-number">1</span>)];
}
<span class="hljs-keyword">var</span> sample = isArrayLike(obj) ? clone(obj) : values(obj);
<span class="hljs-keyword">var</span> sample = toArray(obj);
<span class="hljs-keyword">var</span> length = <span class="hljs-keyword">get</span><span class="hljs-title">Length</span>(<span class="hljs-params">sample</span>);
<span class="hljs-title">n</span> = <span class="hljs-title">Math</span>.<span class="hljs-title">max</span>(<span class="hljs-params">Math.min(n, length</span>), 0);
<span class="hljs-title">var</span> <span class="hljs-title">last</span> = <span class="hljs-title">length</span> - 1;
Expand Down
112 changes: 56 additions & 56 deletions docs/underscore-esm.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ <h1>underscore-esm.js</h1>
<div class="pilwrap ">
<a class="pilcrow" href="#section-1">&#182;</a>
</div>
<pre><code>Underscore.js <span class="hljs-number">1.13</span><span class="hljs-number">.1</span>
<pre><code>Underscore.js <span class="hljs-number">1.13</span><span class="hljs-number">.2</span>
<span class="hljs-attr">https</span>:<span class="hljs-comment">//underscorejs.org</span>
(c) <span class="hljs-number">2009</span><span class="hljs-number">-2021</span> Jeremy Ashkenas, Julian Gonggrijp, and DocumentCloud and Investigative Reporters &amp; Editors
Underscore may be freely distributed under the MIT license.</code></pre>
Expand All @@ -46,7 +46,7 @@ <h1>underscore-esm.js</h1>

</div>

<div class="content"><div class='highlight'><pre><span class="hljs-keyword">var</span> VERSION = <span class="hljs-string">'1.13.1'</span>;</pre></div></div>
<div class="content"><div class='highlight'><pre><span class="hljs-keyword">var</span> VERSION = <span class="hljs-string">'1.13.2'</span>;</pre></div></div>

</li>

Expand Down Expand Up @@ -667,7 +667,7 @@ <h1>underscore-esm.js</h1>
<span class="hljs-keyword">var</span> hash = {};
<span class="hljs-keyword">for</span> (<span class="hljs-keyword">var</span> l = keys.length, i = <span class="hljs-number">0</span>; i &lt; l; ++i) hash[keys[i]] = <span class="hljs-literal">true</span>;
<span class="hljs-keyword">return</span> {
<span class="hljs-attr">contains</span>: <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">key</span>) </span>{ <span class="hljs-keyword">return</span> hash[key]; },
<span class="hljs-attr">contains</span>: <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">key</span>) </span>{ <span class="hljs-keyword">return</span> hash[key] === <span class="hljs-literal">true</span>; },
<span class="hljs-attr">push</span>: <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">key</span>) </span>{
hash[key] = <span class="hljs-literal">true</span>;
<span class="hljs-keyword">return</span> keys.push(key);
Expand Down Expand Up @@ -3713,6 +3713,44 @@ <h1>underscore-esm.js</h1>
<div class="pilwrap ">
<a class="pilcrow" href="#section-180">&#182;</a>
</div>
<p>Safely create a real, live array from anything iterable.</p>

</div>

<div class="content"><div class='highlight'><pre><span class="hljs-keyword">var</span> reStrSymbol = <span class="hljs-regexp">/[^\ud800-\udfff]|[\ud800-\udbff][\udc00-\udfff]|[\ud800-\udfff]/g</span>;
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">toArray</span>(<span class="hljs-params">obj</span>) </span>{
<span class="hljs-keyword">if</span> (!obj) <span class="hljs-keyword">return</span> [];
<span class="hljs-keyword">if</span> (isArray(obj)) <span class="hljs-keyword">return</span> slice.call(obj);
<span class="hljs-keyword">if</span> (isString(obj)) {</pre></div></div>

</li>


<li id="section-181">
<div class="annotation">

<div class="pilwrap ">
<a class="pilcrow" href="#section-181">&#182;</a>
</div>
<p>Keep surrogate pair characters together.</p>

</div>

<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">return</span> obj.match(reStrSymbol);
}
<span class="hljs-keyword">if</span> (isArrayLike(obj)) <span class="hljs-keyword">return</span> map(obj, identity);
<span class="hljs-keyword">return</span> values(obj);
}</pre></div></div>

</li>


<li id="section-182">
<div class="annotation">

<div class="pilwrap ">
<a class="pilcrow" href="#section-182">&#182;</a>
</div>
<p>Sample <strong>n</strong> random values from a collection using the modern version of the
<a href="https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle">Fisher-Yates shuffle</a>.
If <strong>n</strong> is not specified, returns a single random element.
Expand All @@ -3725,7 +3763,7 @@ <h1>underscore-esm.js</h1>
<span class="hljs-keyword">if</span> (!isArrayLike(obj)) obj = values(obj);
<span class="hljs-keyword">return</span> obj[random(obj.length - <span class="hljs-number">1</span>)];
}
<span class="hljs-keyword">var</span> sample = isArrayLike(obj) ? clone(obj) : values(obj);
<span class="hljs-keyword">var</span> sample = toArray(obj);
<span class="hljs-keyword">var</span> length = <span class="hljs-keyword">get</span><span class="hljs-title">Length</span>(<span class="hljs-params">sample</span>);
<span class="hljs-title">n</span> = <span class="hljs-title">Math</span>.<span class="hljs-title">max</span>(<span class="hljs-params">Math.min(n, length</span>), 0);
<span class="hljs-title">var</span> <span class="hljs-title">last</span> = <span class="hljs-title">length</span> - 1;
Expand All @@ -3741,11 +3779,11 @@ <h1>underscore-esm.js</h1>
</li>


<li id="section-181">
<li id="section-183">
<div class="annotation">

<div class="pilwrap ">
<a class="pilcrow" href="#section-181">&#182;</a>
<a class="pilcrow" href="#section-183">&#182;</a>
</div>
<p>Shuffle a collection.</p>

Expand All @@ -3758,11 +3796,11 @@ <h1>underscore-esm.js</h1>
</li>


<li id="section-182">
<li id="section-184">
<div class="annotation">

<div class="pilwrap ">
<a class="pilcrow" href="#section-182">&#182;</a>
<a class="pilcrow" href="#section-184">&#182;</a>
</div>
<p>Sort the object’s values by a criterion produced by an iteratee.</p>

Expand Down Expand Up @@ -3791,11 +3829,11 @@ <h1>underscore-esm.js</h1>
</li>


<li id="section-183">
<li id="section-185">
<div class="annotation">

<div class="pilwrap ">
<a class="pilcrow" href="#section-183">&#182;</a>
<a class="pilcrow" href="#section-185">&#182;</a>
</div>
<p>An internal function used for aggregate “group by” operations.</p>

Expand All @@ -3816,11 +3854,11 @@ <h1>underscore-esm.js</h1>
</li>


<li id="section-184">
<li id="section-186">
<div class="annotation">

<div class="pilwrap ">
<a class="pilcrow" href="#section-184">&#182;</a>
<a class="pilcrow" href="#section-186">&#182;</a>
</div>
<p>Groups the object’s values by a criterion. Pass either a string attribute
to group by, or a function that returns the criterion.</p>
Expand All @@ -3834,11 +3872,11 @@ <h1>underscore-esm.js</h1>
</li>


<li id="section-185">
<li id="section-187">
<div class="annotation">

<div class="pilwrap ">
<a class="pilcrow" href="#section-185">&#182;</a>
<a class="pilcrow" href="#section-187">&#182;</a>
</div>
<p>Indexes the object’s values by a criterion, similar to <code>_.groupBy</code>, but for
when you know that your index values will be unique.</p>
Expand All @@ -3852,11 +3890,11 @@ <h1>underscore-esm.js</h1>
</li>


<li id="section-186">
<li id="section-188">
<div class="annotation">

<div class="pilwrap ">
<a class="pilcrow" href="#section-186">&#182;</a>
<a class="pilcrow" href="#section-188">&#182;</a>
</div>
<p>Counts instances of an object that group by a certain criterion. Pass
either a string attribute to count by, or a function that returns the
Expand All @@ -3871,11 +3909,11 @@ <h1>underscore-esm.js</h1>
</li>


<li id="section-187">
<li id="section-189">
<div class="annotation">

<div class="pilwrap ">
<a class="pilcrow" href="#section-187">&#182;</a>
<a class="pilcrow" href="#section-189">&#182;</a>
</div>
<p>Split a collection into two arrays: one whose elements all pass the given
truth test, and one whose elements all do not pass the truth test.</p>
Expand All @@ -3889,44 +3927,6 @@ <h1>underscore-esm.js</h1>
</li>


<li id="section-188">
<div class="annotation">

<div class="pilwrap ">
<a class="pilcrow" href="#section-188">&#182;</a>
</div>
<p>Safely create a real, live array from anything iterable.</p>

</div>

<div class="content"><div class='highlight'><pre><span class="hljs-keyword">var</span> reStrSymbol = <span class="hljs-regexp">/[^\ud800-\udfff]|[\ud800-\udbff][\udc00-\udfff]|[\ud800-\udfff]/g</span>;
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">toArray</span>(<span class="hljs-params">obj</span>) </span>{
<span class="hljs-keyword">if</span> (!obj) <span class="hljs-keyword">return</span> [];
<span class="hljs-keyword">if</span> (isArray(obj)) <span class="hljs-keyword">return</span> slice.call(obj);
<span class="hljs-keyword">if</span> (isString(obj)) {</pre></div></div>

</li>


<li id="section-189">
<div class="annotation">

<div class="pilwrap ">
<a class="pilcrow" href="#section-189">&#182;</a>
</div>
<p>Keep surrogate pair characters together.</p>

</div>

<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">return</span> obj.match(reStrSymbol);
}
<span class="hljs-keyword">if</span> (isArrayLike(obj)) <span class="hljs-keyword">return</span> map(obj, identity);
<span class="hljs-keyword">return</span> values(obj);
}</pre></div></div>

</li>


<li id="section-190">
<div class="annotation">

Expand Down
42 changes: 31 additions & 11 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@
<div id="sidebar" class="interface overlay-content">

<a class="toc_title" href="#">
Underscore.js <span class="version">(1.13.1)</span>
Underscore.js <span class="version">(1.13.2)</span>
</a>

<ul class="toc_section">
Expand Down Expand Up @@ -551,7 +551,7 @@
<i>Underscore is an open-source component of <a href="https://documentcloud.org/">DocumentCloud</a>.</i>
</p>

<h2>v1.13.1 Downloads <i style="padding-left: 12px; font-size:12px;">(Right-click, and use "Save As")</i></h2>
<h2>v1.13.2 Downloads <i style="padding-left: 12px; font-size:12px;">(Right-click, and use "Save As")</i></h2>

<table>
<tr>
Expand Down Expand Up @@ -595,32 +595,32 @@ <h2>v1.13.1 Downloads <i style="padding-left: 12px; font-size:12px;">(Right-clic
</tr>
</table>

<h2>v1.13.1 CDN URLs <i style="padding-left: 12px; font-size:12px;">(Use with <tt>&lt;script src="..."&gt;&lt;/script&gt;</tt>)</i></h2>
<h2>v1.13.2 CDN URLs <i style="padding-left: 12px; font-size:12px;">(Use with <tt>&lt;script src="..."&gt;&lt;/script&gt;</tt>)</i></h2>

<ul>
<li>
<tt>https://cdn.jsdelivr.net/npm/underscore@1.13.1/underscore-umd-min.js</tt>
<tt>https://cdn.jsdelivr.net/npm/underscore@1.13.2/underscore-umd-min.js</tt>
</li>
<li>
<tt>https://cdn.jsdelivr.net/npm/underscore@1.13.1/underscore-esm-min.js</tt>
<tt>https://cdn.jsdelivr.net/npm/underscore@1.13.2/underscore-esm-min.js</tt>
</li>
<li>
<tt>https://unpkg.com/underscore@1.13.1/underscore-umd-min.js</tt>
<tt>https://unpkg.com/underscore@1.13.2/underscore-umd-min.js</tt>
</li>
<li>
<tt>https://unpkg.com/underscore@1.13.1/underscore-esm-min.js</tt>
<tt>https://unpkg.com/underscore@1.13.2/underscore-esm-min.js</tt>
</li>
<li>
<tt>https://pagecdn.io/lib/underscore/1.13.1/underscore-umd-min.js</tt>
<tt>https://pagecdn.io/lib/underscore/1.13.2/underscore-umd-min.js</tt>
</li>
<li>
<tt>https://pagecdn.io/lib/underscore/1.13.1/underscore-esm-min.js</tt>
<tt>https://pagecdn.io/lib/underscore/1.13.2/underscore-esm-min.js</tt>
</li>
<li>
<tt>https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.13.1/underscore-umd-min.js</tt>
<tt>https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.13.2/underscore-umd-min.js</tt>
</li>
<li>
<tt>https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.13.1/underscore-esm-min.js</tt>
<tt>https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.13.2/underscore-esm-min.js</tt>
</li>
</ul>

Expand Down Expand Up @@ -2798,6 +2798,26 @@ <h2 id="notes">Notes</h2>

<h2 id="changelog">Change Log</h2>

<p id="1.13.2">
<b class="header">1.13.2</b> &mdash; <small><i>December 16, 2021</i></small> &mdash; <a href="https://github.com/jashkenas/underscore/compare/1.13.1...1.13.2">Diff</a> &mdash; <a href="https://cdn.statically.io/gh/jashkenas/underscore/1.13.2/index.html">Docs</a><br />
<ul>
<li>
Fixes a regression introduced in 1.9.0 that caused
<tt>_.sample</tt> and <tt>_.shuffle</tt> to no longer work on
strings.
</li>
<li>
Fixes an issue in IE8 compatibility code.
</li>
<li>
Makes the website mobile-friendly.
</li>
<li>
Various other minor documentation enhancements and a new test.
</li>
</ul>
</p>

<p id="1.13.1">
<b class="header">1.13.1</b> &mdash; <small><i>April 15, 2021</i></small> &mdash; <a href="https://github.com/jashkenas/underscore/compare/1.13.0...1.13.1">Diff</a> &mdash; <a href="https://cdn.statically.io/gh/jashkenas/underscore/1.13.1/index.html">Docs</a><br />
<ul>
Expand Down
2 changes: 1 addition & 1 deletion modules/_setup.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Current version.
export var VERSION = '1.13.1';
export var VERSION = '1.13.2';

// Establish the root object, `window` (`self`) in the browser, `global`
// on the server, or `this` in some virtual machines. We use `self`
Expand Down
2 changes: 1 addition & 1 deletion modules/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Named Exports
// =============

// Underscore.js 1.13.1
// Underscore.js 1.13.2
// https://underscorejs.org
// (c) 2009-2021 Jeremy Ashkenas, Julian Gonggrijp, and DocumentCloud and Investigative Reporters & Editors
// Underscore may be freely distributed under the MIT license.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "underscore",
"description": "JavaScript's functional programming helper library.",
"version": "1.13.1",
"version": "1.13.2",
"author": "Jeremy Ashkenas <jeremy@documentcloud.org>",
"license": "MIT",
"homepage": "https://underscorejs.org",
Expand Down
4 changes: 2 additions & 2 deletions underscore-esm-min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion underscore-esm-min.js.map

Large diffs are not rendered by default.

Loading