diff --git a/docs/modules/_collectNonEnumProps.html b/docs/modules/_collectNonEnumProps.html index e8f3fc3ae..d9f7f67a3 100644 --- a/docs/modules/_collectNonEnumProps.html +++ b/docs/modules/_collectNonEnumProps.html @@ -873,7 +873,7 @@

_collectNonEnumProps.js

var hash = {}; for (var l = keys.length, i = 0; i < l; ++i) hash[keys[i]] = true; return { - contains: function(key) { return hash[key]; }, + contains: function(key) { return hash[key] === true; }, push: function(key) { hash[key] = true; return keys.push(key); diff --git a/docs/modules/_setup.html b/docs/modules/_setup.html index f726f46f2..ed95fc944 100644 --- a/docs/modules/_setup.html +++ b/docs/modules/_setup.html @@ -850,7 +850,7 @@

_setup.js

-
export var VERSION = '1.13.1';
+
export var VERSION = '1.13.2';
diff --git a/docs/modules/index.html b/docs/modules/index.html index 6081909d7..9cdfa14f9 100644 --- a/docs/modules/index.html +++ b/docs/modules/index.html @@ -865,7 +865,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.
diff --git a/docs/modules/sample.html b/docs/modules/sample.html index 3e5131d89..af6993859 100644 --- a/docs/modules/sample.html +++ b/docs/modules/sample.html @@ -850,10 +850,10 @@

sample.js

import isArrayLike from './_isArrayLike.js';
-import clone from './clone.js';
 import values from './values.js';
 import getLength from './_getLength.js';
-import random from './random.js';
+import random from './random.js'; +import toArray from './toArray.js';
@@ -876,7 +876,7 @@

sample.js

if (!isArrayLike(obj)) obj = values(obj); return obj[random(obj.length - 1)]; } - var sample = isArrayLike(obj) ? clone(obj) : values(obj); + var sample = toArray(obj); var length = getLength(sample); n = Math.max(Math.min(n, length), 0); var last = length - 1; diff --git a/docs/underscore-esm.html b/docs/underscore-esm.html index 27f3c2387..525c9c997 100644 --- a/docs/underscore-esm.html +++ b/docs/underscore-esm.html @@ -27,7 +27,7 @@

underscore-esm.js

-
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.
@@ -46,7 +46,7 @@

underscore-esm.js

-
var VERSION = '1.13.1';
+
var VERSION = '1.13.2';
@@ -667,7 +667,7 @@

underscore-esm.js

var hash = {}; for (var l = keys.length, i = 0; i < l; ++i) hash[keys[i]] = true; return { - contains: function(key) { return hash[key]; }, + contains: function(key) { return hash[key] === true; }, push: function(key) { hash[key] = true; return keys.push(key); @@ -3713,6 +3713,44 @@

underscore-esm.js

+

Safely create a real, live array from anything iterable.

+ + + +
var reStrSymbol = /[^\ud800-\udfff]|[\ud800-\udbff][\udc00-\udfff]|[\ud800-\udfff]/g;
+function toArray(obj) {
+  if (!obj) return [];
+  if (isArray(obj)) return slice.call(obj);
+  if (isString(obj)) {
+ + + + +
  • +
    + +
    + +
    +

    Keep surrogate pair characters together.

    + +
    + +
        return obj.match(reStrSymbol);
    +  }
    +  if (isArrayLike(obj)) return map(obj, identity);
    +  return values(obj);
    +}
    + +
  • + + +
  • +
    + +
    + +

    Sample n random values from a collection using the modern version of the Fisher-Yates shuffle. If n is not specified, returns a single random element. @@ -3725,7 +3763,7 @@

    underscore-esm.js

    if (!isArrayLike(obj)) obj = values(obj); return obj[random(obj.length - 1)]; } - var sample = isArrayLike(obj) ? clone(obj) : values(obj); + var sample = toArray(obj); var length = getLength(sample); n = Math.max(Math.min(n, length), 0); var last = length - 1; @@ -3741,11 +3779,11 @@

    underscore-esm.js

  • -
  • +
  • - +

    Shuffle a collection.

    @@ -3758,11 +3796,11 @@

    underscore-esm.js

  • -
  • +
  • - +

    Sort the object’s values by a criterion produced by an iteratee.

    @@ -3791,11 +3829,11 @@

    underscore-esm.js

  • -
  • +
  • - +

    An internal function used for aggregate “group by” operations.

    @@ -3816,11 +3854,11 @@

    underscore-esm.js

  • -
  • +
  • - +

    Groups the object’s values by a criterion. Pass either a string attribute to group by, or a function that returns the criterion.

    @@ -3834,11 +3872,11 @@

    underscore-esm.js

  • -
  • +
  • - +

    Indexes the object’s values by a criterion, similar to _.groupBy, but for when you know that your index values will be unique.

    @@ -3852,11 +3890,11 @@

    underscore-esm.js

  • -
  • +
  • - +

    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 @@ -3871,11 +3909,11 @@

    underscore-esm.js

  • -
  • +
  • - +

    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.

    @@ -3889,44 +3927,6 @@

    underscore-esm.js

  • -
  • -
    - -
    - -
    -

    Safely create a real, live array from anything iterable.

    - -
    - -
    var reStrSymbol = /[^\ud800-\udfff]|[\ud800-\udbff][\udc00-\udfff]|[\ud800-\udfff]/g;
    -function toArray(obj) {
    -  if (!obj) return [];
    -  if (isArray(obj)) return slice.call(obj);
    -  if (isString(obj)) {
    - -
  • - - -
  • -
    - -
    - -
    -

    Keep surrogate pair characters together.

    - -
    - -
        return obj.match(reStrSymbol);
    -  }
    -  if (isArrayLike(obj)) return map(obj, identity);
    -  return values(obj);
    -}
    - -
  • - -
  • diff --git a/index.html b/index.html index 1480667f8..76d5feb5e 100644 --- a/index.html +++ b/index.html @@ -262,7 +262,7 @@