Codebase list node-d3-shape / b4233362-025e-4f1a-991a-d84f781b33ec/upstream src / array.js
b4233362-025e-4f1a-991a-d84f781b33ec/upstream

Tree @b4233362-025e-4f1a-991a-d84f781b33ec/upstream (Download .tar.gz)

array.js @b4233362-025e-4f1a-991a-d84f781b33ec/upstreamraw · history · blame

1
2
3
4
5
6
7
export var slice = Array.prototype.slice;

export default function(x) {
  return typeof x === "object" && "length" in x
    ? x // Array, TypedArray, NodeList, array-like
    : Array.from(x); // Map, Set, iterable, string, or anything else
}