Skip to content

Commit df76a1f

Browse files
karyna-tandrewbess
authored andcommitted
AC-2546: update built-in underscore.js to 1.13.2
1 parent 2b98dc6 commit df76a1f

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

lib/web/underscore.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
exports.noConflict = function () { global._ = current; return exports; };
88
}()));
99
}(this, (function () {
10-
// Underscore.js 1.13.1
10+
// Underscore.js 1.13.2
1111
// https://underscorejs.org
1212
// (c) 2009-2021 Jeremy Ashkenas, Julian Gonggrijp, and DocumentCloud and Investigative Reporters & Editors
1313
// Underscore may be freely distributed under the MIT license.
1414

1515
// Current version.
16-
var VERSION = '1.13.1';
16+
var VERSION = '1.13.2';
1717

1818
// Establish the root object, `window` (`self`) in the browser, `global`
1919
// on the server, or `this` in some virtual machines. We use `self`
@@ -249,7 +249,7 @@
249249
var hash = {};
250250
for (var l = keys.length, i = 0; i < l; ++i) hash[keys[i]] = true;
251251
return {
252-
contains: function(key) { return hash[key]; },
252+
contains: function(key) { return hash[key] === true; },
253253
push: function(key) {
254254
hash[key] = true;
255255
return keys.push(key);
@@ -1513,6 +1513,19 @@
15131513
return result;
15141514
}
15151515

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+
15161529
// Sample **n** random values from a collection using the modern version of the
15171530
// [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher–Yates_shuffle).
15181531
// If **n** is not specified, returns a single random element.
@@ -1522,7 +1535,7 @@
15221535
if (!isArrayLike(obj)) obj = values(obj);
15231536
return obj[random(obj.length - 1)];
15241537
}
1525-
var sample = isArrayLike(obj) ? clone(obj) : values(obj);
1538+
var sample = toArray(obj);
15261539
var length = getLength(sample);
15271540
n = Math.max(Math.min(n, length), 0);
15281541
var last = length - 1;
@@ -1599,19 +1612,6 @@
15991612
result[pass ? 0 : 1].push(value);
16001613
}, true);
16011614

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-
16151615
// Return the number of elements in a collection.
16161616
function size(obj) {
16171617
if (obj == null) return 0;

0 commit comments

Comments
 (0)