MCPcopy Index your code
hub / github.com/jashkenas/underscore / toArray

Function toArray

underscore.js:1553–1562  ·  view source on GitHub ↗
(obj)

Source from the content-addressed store, hash-verified

1551 // Safely create a real, live array from anything iterable.
1552 var reStrSymbol = /[^\ud800-\udfff]|[\ud800-\udbff][\udc00-\udfff]|[\ud800-\udfff]/g;
1553 function toArray(obj) {
1554 if (!obj) return [];
1555 if (isArray(obj)) return slice.call(obj);
1556 if (isString(obj)) {
1557 // Keep surrogate pair characters together.
1558 return obj.match(reStrSymbol);
1559 }
1560 if (isArrayLike(obj)) return map(obj, identity);
1561 return values(obj);
1562 }
1563
1564 // Sample **n** random values from a collection using the modern version of the
1565 // [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher–Yates_shuffle).

Callers 1

sampleFunction · 0.70

Calls 2

mapFunction · 0.70
valuesFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…