|
180 | 180 | <div id="sidebar" class="interface"> |
181 | 181 |
|
182 | 182 | <a class="toc_title" href="#"> |
183 | | - Underscore.js <span class="version">(1.8.2)</span> |
| 183 | + Underscore.js <span class="version">(1.8.3)</span> |
184 | 184 | </a> |
185 | 185 | <ul class="toc_section"> |
186 | 186 | <li>» <a href="https://github.com/jashkenas/underscore">GitHub Repository</a></li> |
|
279 | 279 | <li>- <a href="#mapObject">mapObject</a></li> |
280 | 280 | <li>- <a href="#pairs">pairs</a></li> |
281 | 281 | <li>- <a href="#invert">invert</a></li> |
| 282 | + <li>- <a href="#create">create</a></li> |
282 | 283 | <li>- <a href="#object-functions">functions</a></li> |
283 | 284 | <li>- <a href="#findKey">findKey</a></li> |
284 | 285 | <li>- <a href="#extend">extend</a></li> |
@@ -402,11 +403,11 @@ <h2>Downloads <i style="padding-left: 12px; font-size:12px;">(Right-click, and u |
402 | 403 |
|
403 | 404 | <table> |
404 | 405 | <tr> |
405 | | - <td><a href="underscore.js">Development Version (1.8.2)</a></td> |
406 | | - <td><i>51kb, Uncompressed with Plentiful Comments</i></td> |
| 406 | + <td><a href="underscore.js">Development Version (1.8.3)</a></td> |
| 407 | + <td><i>52kb, Uncompressed with Plentiful Comments</i></td> |
407 | 408 | </tr> |
408 | 409 | <tr> |
409 | | - <td><a href="underscore-min.js">Production Version (1.8.2)</a></td> |
| 410 | + <td><a href="underscore-min.js">Production Version (1.8.3)</a></td> |
410 | 411 | <td> |
411 | 412 | <i>5.7kb, Minified and Gzipped</i> |
412 | 413 | <small>(<a href="underscore-min.map">Source Map</a>)</small> |
@@ -939,14 +940,15 @@ <h2 id="arrays">Array Functions</h2> |
939 | 940 | <span class="alias">Alias: <b>unique</b></span> |
940 | 941 | <br /> |
941 | 942 | Produces a duplicate-free version of the <b>array</b>, using <i>===</i> to test |
942 | | - object equality. If you know in advance that the <b>array</b> is sorted, |
| 943 | + object equality. In particular only the first occurence of each value is kept. |
| 944 | + If you know in advance that the <b>array</b> is sorted, |
943 | 945 | passing <i>true</i> for <b>isSorted</b> will run a much faster algorithm. |
944 | 946 | If you want to compute unique items based on a transformation, pass an |
945 | 947 | <b>iteratee</b> function. |
946 | 948 | </p> |
947 | 949 | <pre> |
948 | | -_.uniq([1, 2, 1, 3, 1, 4]); |
949 | | -=> [1, 2, 3, 4] |
| 950 | +_.uniq([1, 2, 1, 4, 1, 3]); |
| 951 | +=> [1, 2, 4, 3] |
950 | 952 | </pre> |
951 | 953 |
|
952 | 954 | <p id="zip"> |
@@ -1369,7 +1371,7 @@ <h2 id="objects">Object Functions</h2> |
1369 | 1371 | </pre> |
1370 | 1372 |
|
1371 | 1373 | <p id="mapObject"> |
1372 | | - <b class="header">mapObject</b><code>_.mapObject(array, iteratee, [context])</code> |
| 1374 | + <b class="header">mapObject</b><code>_.mapObject(object, iteratee, [context])</code> |
1373 | 1375 | <br /> |
1374 | 1376 | Like <a href="#map">map</a>, but for objects. Transform the value |
1375 | 1377 | of each property in turn. |
@@ -1401,6 +1403,17 @@ <h2 id="objects">Object Functions</h2> |
1401 | 1403 | <pre> |
1402 | 1404 | _.invert({Moe: "Moses", Larry: "Louis", Curly: "Jerome"}); |
1403 | 1405 | => {Moses: "Moe", Louis: "Larry", Jerome: "Curly"}; |
| 1406 | +</pre> |
| 1407 | + |
| 1408 | + <p id="create"> |
| 1409 | + <b class="header">create</b><code>_.create(prototype, props)</code> |
| 1410 | + <br /> |
| 1411 | + Creates a new object with the given prototype, optionally attaching |
| 1412 | + <b>props</b> as <i>own</i> properties. Basically, <tt>Object.create</tt>, |
| 1413 | + but without all of the property descriptor jazz. |
| 1414 | + </p> |
| 1415 | + <pre> |
| 1416 | +var moe = _.create(Stooge.prototype, {name: "Moe"}); |
1404 | 1417 | </pre> |
1405 | 1418 |
|
1406 | 1419 | <p id="object-functions"> |
@@ -2192,6 +2205,20 @@ <h2 id="links">Links & Suggested Reading</h2> |
2192 | 2205 |
|
2193 | 2206 | <h2 id="changelog">Change Log</h2> |
2194 | 2207 |
|
| 2208 | + <p id="1.8.3"> |
| 2209 | + <b class="header">1.8.3</b> — <small><i>April 2, 2015</i></small> — <a href="https://github.com/jashkenas/underscore/compare/1.8.2...1.8.3">Diff</a> — <a href="https://cdn.rawgit.com/jashkenas/underscore/1.8.3/index.html">Docs</a><br /> |
| 2210 | + <ul> |
| 2211 | + <li> |
| 2212 | + Adds an <tt>_.create</tt> method, as a slimmed down version of |
| 2213 | + <tt>Object.create</tt>. |
| 2214 | + </li> |
| 2215 | + <li> |
| 2216 | + Works around an iOS bug that can improperly cause <tt>isArrayLike</tt> |
| 2217 | + to be JIT-ed. Also fixes a bug when passing <tt>0</tt> to <tt>isArrayLike</tt>. |
| 2218 | + </li> |
| 2219 | + </ul> |
| 2220 | + </p> |
| 2221 | + |
2195 | 2222 | <p id="1.8.2"> |
2196 | 2223 | <b class="header">1.8.2</b> — <small><i>Feb. 22, 2015</i></small> — <a href="https://github.com/jashkenas/underscore/compare/1.8.1...1.8.2">Diff</a> — <a href="https://cdn.rawgit.com/jashkenas/underscore/1.8.2/index.html">Docs</a><br /> |
2197 | 2224 | <ul> |
|
0 commit comments