|
7 | 7 | exports.noConflict = function () { global._ = current; return exports; }; |
8 | 8 | }())); |
9 | 9 | }(this, (function () { |
10 | | - // Underscore.js 1.13.1 |
| 10 | + // Underscore.js 1.13.2 |
11 | 11 | // https://underscorejs.org |
12 | 12 | // (c) 2009-2021 Jeremy Ashkenas, Julian Gonggrijp, and DocumentCloud and Investigative Reporters & Editors |
13 | 13 | // Underscore may be freely distributed under the MIT license. |
14 | 14 |
|
15 | 15 | // Current version. |
16 | | - var VERSION = '1.13.1'; |
| 16 | + var VERSION = '1.13.2'; |
17 | 17 |
|
18 | 18 | // Establish the root object, `window` (`self`) in the browser, `global` |
19 | 19 | // on the server, or `this` in some virtual machines. We use `self` |
|
249 | 249 | var hash = {}; |
250 | 250 | for (var l = keys.length, i = 0; i < l; ++i) hash[keys[i]] = true; |
251 | 251 | return { |
252 | | - contains: function(key) { return hash[key]; }, |
| 252 | + contains: function(key) { return hash[key] === true; }, |
253 | 253 | push: function(key) { |
254 | 254 | hash[key] = true; |
255 | 255 | return keys.push(key); |
|
1513 | 1513 | return result; |
1514 | 1514 | } |
1515 | 1515 |
|
| 1516 | + // Safely create a real, live array from anything iterable. |
| 1517 | + var reStrSymbol = /[^\ud800-\udfff]|[\ud800-\udbff][\udc00-\udfff]|[\ud800-\udfff]/g; |
| 1518 | + function toArray(obj) { |
| 1519 | + if (!obj) return []; |
| 1520 | + if (isArray(obj)) return slice.call(obj); |
| 1521 | + if (isString(obj)) { |
| 1522 | + // Keep surrogate pair characters together. |
| 1523 | + return obj.match(reStrSymbol); |
| 1524 | + } |
| 1525 | + if (isArrayLike(obj)) return map(obj, identity); |
| 1526 | + return values(obj); |
| 1527 | + } |
| 1528 | + |
1516 | 1529 | // Sample **n** random values from a collection using the modern version of the |
1517 | 1530 | // [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher–Yates_shuffle). |
1518 | 1531 | // If **n** is not specified, returns a single random element. |
|
1522 | 1535 | if (!isArrayLike(obj)) obj = values(obj); |
1523 | 1536 | return obj[random(obj.length - 1)]; |
1524 | 1537 | } |
1525 | | - var sample = isArrayLike(obj) ? clone(obj) : values(obj); |
| 1538 | + var sample = toArray(obj); |
1526 | 1539 | var length = getLength(sample); |
1527 | 1540 | n = Math.max(Math.min(n, length), 0); |
1528 | 1541 | var last = length - 1; |
|
1599 | 1612 | result[pass ? 0 : 1].push(value); |
1600 | 1613 | }, true); |
1601 | 1614 |
|
1602 | | - // Safely create a real, live array from anything iterable. |
1603 | | - var reStrSymbol = /[^\ud800-\udfff]|[\ud800-\udbff][\udc00-\udfff]|[\ud800-\udfff]/g; |
1604 | | - function toArray(obj) { |
1605 | | - if (!obj) return []; |
1606 | | - if (isArray(obj)) return slice.call(obj); |
1607 | | - if (isString(obj)) { |
1608 | | - // Keep surrogate pair characters together. |
1609 | | - return obj.match(reStrSymbol); |
1610 | | - } |
1611 | | - if (isArrayLike(obj)) return map(obj, identity); |
1612 | | - return values(obj); |
1613 | | - } |
1614 | | - |
1615 | 1615 | // Return the number of elements in a collection. |
1616 | 1616 | function size(obj) { |
1617 | 1617 | if (obj == null) return 0; |
|
0 commit comments