Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

d3-arrays

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

d3-arrays - npm Package Compare versions

Comparing version 0.1.2 to 0.2.0

476

build/arrays.cjs.js
'use strict';
function min(array, f) {
var i = -1,
n = array.length,
a,
b;
if (arguments.length === 1) {
while (++i < n) if ((b = array[i]) != null && b >= b) { a = b; break; }
while (++i < n) if ((b = array[i]) != null && a > b) a = b;
}
else {
while (++i < n) if ((b = f.call(array, array[i], i)) != null && b >= b) { a = b; break; }
while (++i < n) if ((b = f.call(array, array[i], i)) != null && a > b) a = b;
}
return a;
function ascending(a, b) {
return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
};
function transpose$1(matrix) {
if (!(n = matrix.length)) return [];
for (var i = -1, m = min(matrix, length), transpose = new Array(m); ++i < m;) {
for (var j = -1, n, row = transpose[i] = new Array(n); ++j < n;) {
row[j] = matrix[j][i];
function bisector(compare) {
if (compare.length === 1) compare = ascendingComparator(compare);
return {
left: function(a, x, lo, hi) {
if (arguments.length < 3) lo = 0;
if (arguments.length < 4) hi = a.length;
while (lo < hi) {
var mid = lo + hi >>> 1;
if (compare(a[mid], x) < 0) lo = mid + 1;
else hi = mid;
}
return lo;
},
right: function(a, x, lo, hi) {
if (arguments.length < 3) lo = 0;
if (arguments.length < 4) hi = a.length;
while (lo < hi) {
var mid = lo + hi >>> 1;
if (compare(a[mid], x) > 0) hi = mid;
else lo = mid + 1;
}
return lo;
}
}
return transpose;
};
};
function length(d) {
return d.length;
function ascendingComparator(f) {
return function(d, x) {
return ascending(f(d), x);
};
}
function zip() {
return transpose$1(arguments);
var ascendingBisect = bisector(ascending);
var bisectRight = ascendingBisect.right;
var bisectLeft = ascendingBisect.left;
function descending(a, b) {
return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
};

@@ -76,43 +83,43 @@

function values$1(map) {
var values = [];
for (var key in map) values.push(map[key]);
return values;
function deviation() {
var v = variance.apply(this, arguments);
return v ? Math.sqrt(v) : v;
};
function sum(array, f) {
var s = 0,
function entries(map) {
var entries = [];
for (var key in map) entries.push({key: key, value: map[key]});
return entries;
};
function extent(array, f) {
var i = -1,
n = array.length,
a,
i = -1;
b,
c;
if (arguments.length === 1) {
while (++i < n) if (!isNaN(a = +array[i])) s += a; // Note: zero and null are equivalent.
while (++i < n) if ((b = array[i]) != null && b >= b) { a = c = b; break; }
while (++i < n) if ((b = array[i]) != null) {
if (a > b) a = b;
if (c < b) c = b;
}
}
else {
while (++i < n) if (!isNaN(a = +f.call(array, array[i], i))) s += a;
while (++i < n) if ((b = f.call(array, array[i], i)) != null && b >= b) { a = c = b; break; }
while (++i < n) if ((b = f.call(array, array[i], i)) != null) {
if (a > b) a = b;
if (c < b) c = b;
}
}
return s;
return [a, c];
};
function shuffle(array, i0, i1) {
if ((m = arguments.length) < 3) {
i1 = array.length;
if (m < 2) i0 = 0;
}
var m = i1 - i0,
t,
i;
while (m) {
i = Math.random() * m-- | 0;
t = array[m + i0];
array[m + i0] = array[i + i0];
array[i + i0] = t;
}
return array;
function keys(map) {
var keys = [];
for (var key in map) keys.push(key);
return keys;
};

@@ -162,4 +169,4 @@

},
forEach: function(f) {
for (var property in this) if (property[0] === prefix) f.call(this, property.slice(1), this[property]);
each: function(f) {
for (var property in this) if (property[0] === prefix) f.call(this, this[property], property.slice(1));
}

@@ -172,3 +179,3 @@ };

// Copy constructor.
if (object instanceof Map) object.forEach(function(key, value) { map.set(key, value); });
if (object instanceof Map) object.each(function(value, key) { map.set(key, value); });

@@ -186,3 +193,3 @@ // Index array by numeric index or specified key function.

// Convert object to map.
else for (var key in object) map.set(key, object[key]);
else if (object) for (var key in object) map.set(key, object[key]);

@@ -192,46 +199,37 @@ return map;

function Set() {}
function max(array, f) {
var i = -1,
n = array.length,
a,
b;
var proto = map.prototype;
if (arguments.length === 1) {
while (++i < n) if ((b = array[i]) != null && b >= b) { a = b; break; }
while (++i < n) if ((b = array[i]) != null && b > a) a = b;
}
Set.prototype = set.prototype = {
has: proto.has,
add: function(value) {
value += "";
this[prefix + value] = true;
return value;
},
remove: proto.remove,
values: proto.keys,
size: proto.size,
empty: proto.empty,
forEach: function(f) {
for (var property in this) if (property[0] === prefix) f.call(this, property.slice(1));
else {
while (++i < n) if ((b = f.call(array, array[i], i)) != null && b >= b) { a = b; break; }
while (++i < n) if ((b = f.call(array, array[i], i)) != null && b > a) a = b;
}
return a;
};
function set(array) {
var set = new Set;
if (array) for (var i = 0, n = array.length; i < n; ++i) set.add(array[i]);
return set;
}
function mean(array, f) {
var s = 0,
n = array.length,
a,
i = -1,
j = n;
function range$1(start, stop, step) {
if ((n = arguments.length) < 3) {
step = 1;
if (n < 2) {
stop = start;
start = 0;
}
if (arguments.length === 1) {
while (++i < n) if (!isNaN(a = number(array[i]))) s += a; else --j;
}
var i = -1,
n = Math.max(0, Math.ceil((stop - start) / step)) | 0,
range = new Array(n);
while (++i < n) {
range[i] = start + i * step;
else {
while (++i < n) if (!isNaN(a = number(f.call(array, array[i], i)))) s += a; else --j;
}
return range;
if (j) return s / j;
};

@@ -248,15 +246,61 @@

function permute(array, indexes) {
var i = indexes.length, permutes = new Array(i);
while (i--) permutes[i] = array[indexes[i]];
return permutes;
function median(array, f) {
var numbers = [],
n = array.length,
a,
i = -1;
if (arguments.length === 1) {
while (++i < n) if (!isNaN(a = number(array[i]))) numbers.push(a);
}
else {
while (++i < n) if (!isNaN(a = number(f.call(array, array[i], i)))) numbers.push(a);
}
if (numbers.length) return quantile(numbers.sort(ascending), .5);
};
function pairs$1(array) {
var i = 0, n = array.length - 1, p0, p1 = array[0], pairs = new Array(n < 0 ? 0 : n);
while (i < n) pairs[i] = [p0 = p1, p1 = array[++i]];
return pairs;
function merge(arrays) {
var n = arrays.length,
m,
i = -1,
j = 0,
merged,
array;
while (++i < n) j += arrays[i].length;
merged = new Array(j);
while (--n >= 0) {
array = arrays[n];
m = array.length;
while (--m >= 0) {
merged[--j] = array[m];
}
}
return merged;
};
function nest$1() {
function min(array, f) {
var i = -1,
n = array.length,
a,
b;
if (arguments.length === 1) {
while (++i < n) if ((b = array[i]) != null && b >= b) { a = b; break; }
while (++i < n) if ((b = array[i]) != null && a > b) a = b;
}
else {
while (++i < n) if ((b = f.call(array, array[i], i)) != null && b >= b) { a = b; break; }
while (++i < n) if ((b = f.call(array, array[i], i)) != null && a > b) a = b;
}
return a;
};
function nest() {
var keys = [],

@@ -291,3 +335,3 @@ sortKeys = [],

valuesByKey.forEach(function(key, values) {
valuesByKey.each(function(values, key) {
setResult(result, key, apply(values, depth, createResult, setResult));

@@ -305,3 +349,3 @@ });

map.forEach(function(key, value) {
map.each(function(value, key) {
array.push({key: key, values: entries(value, depth)});

@@ -342,169 +386,131 @@ });

function merge(arrays) {
var n = arrays.length,
m,
i = -1,
j = 0,
merged,
array;
function pairs(array) {
var i = 0, n = array.length - 1, p0, p1 = array[0], pairs = new Array(n < 0 ? 0 : n);
while (i < n) pairs[i] = [p0 = p1, p1 = array[++i]];
return pairs;
};
while (++i < n) j += arrays[i].length;
merged = new Array(j);
function permute(array, indexes) {
var i = indexes.length, permutes = new Array(i);
while (i--) permutes[i] = array[indexes[i]];
return permutes;
};
while (--n >= 0) {
array = arrays[n];
m = array.length;
while (--m >= 0) {
merged[--j] = array[m];
function range(start, stop, step) {
if ((n = arguments.length) < 3) {
step = 1;
if (n < 2) {
stop = start;
start = 0;
}
}
return merged;
};
var i = -1,
n = Math.max(0, Math.ceil((stop - start) / step)) | 0,
range = new Array(n);
function ascending(a, b) {
return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
while (++i < n) {
range[i] = start + i * step;
}
return range;
};
function median(array, f) {
var numbers = [],
n = array.length,
a,
i = -1;
function Set() {}
if (arguments.length === 1) {
while (++i < n) if (!isNaN(a = number(array[i]))) numbers.push(a);
}
var proto = map.prototype;
else {
while (++i < n) if (!isNaN(a = number(f.call(array, array[i], i)))) numbers.push(a);
Set.prototype = set.prototype = {
has: proto.has,
add: function(value) {
value += "";
this[prefix + value] = true;
return value;
},
remove: proto.remove,
values: proto.keys,
size: proto.size,
empty: proto.empty,
each: function(f) {
for (var property in this) if (property[0] === prefix) f.call(this, property.slice(1));
}
if (numbers.length) return quantile(numbers.sort(ascending), .5);
};
function mean(array, f) {
var s = 0,
n = array.length,
a,
i = -1,
j = n;
function set(object) {
var set = new Set;
if (arguments.length === 1) {
while (++i < n) if (!isNaN(a = number(array[i]))) s += a; else --j;
}
// Copy constructor.
if (object instanceof Set) object.each(function(value) { set.add(value); });
else {
while (++i < n) if (!isNaN(a = number(f.call(array, array[i], i)))) s += a; else --j;
}
// Otherwise, assume it’s an array.
else if (object) for (var i = 0, n = object.length; i < n; ++i) set.add(object[i]);
if (j) return s / j;
};
return set;
}
function max(array, f) {
var i = -1,
n = array.length,
a,
b;
if (arguments.length === 1) {
while (++i < n) if ((b = array[i]) != null && b >= b) { a = b; break; }
while (++i < n) if ((b = array[i]) != null && b > a) a = b;
function shuffle(array, i0, i1) {
if ((m = arguments.length) < 3) {
i1 = array.length;
if (m < 2) i0 = 0;
}
else {
while (++i < n) if ((b = f.call(array, array[i], i)) != null && b >= b) { a = b; break; }
while (++i < n) if ((b = f.call(array, array[i], i)) != null && b > a) a = b;
var m = i1 - i0,
t,
i;
while (m) {
i = Math.random() * m-- | 0;
t = array[m + i0];
array[m + i0] = array[i + i0];
array[i + i0] = t;
}
return a;
return array;
};
function keys(map) {
var keys = [];
for (var key in map) keys.push(key);
return keys;
};
function extent(array, f) {
var i = -1,
function sum(array, f) {
var s = 0,
n = array.length,
a,
b,
c;
i = -1;
if (arguments.length === 1) {
while (++i < n) if ((b = array[i]) != null && b >= b) { a = c = b; break; }
while (++i < n) if ((b = array[i]) != null) {
if (a > b) a = b;
if (c < b) c = b;
}
while (++i < n) if (!isNaN(a = +array[i])) s += a; // Note: zero and null are equivalent.
}
else {
while (++i < n) if ((b = f.call(array, array[i], i)) != null && b >= b) { a = c = b; break; }
while (++i < n) if ((b = f.call(array, array[i], i)) != null) {
if (a > b) a = b;
if (c < b) c = b;
}
while (++i < n) if (!isNaN(a = +f.call(array, array[i], i))) s += a;
}
return [a, c];
return s;
};
function entries(map) {
var entries = [];
for (var key in map) entries.push({key: key, value: map[key]});
return entries;
function transpose(matrix) {
if (!(n = matrix.length)) return [];
for (var i = -1, m = min(matrix, length), transpose = new Array(m); ++i < m;) {
for (var j = -1, n, row = transpose[i] = new Array(n); ++j < n;) {
row[j] = matrix[j][i];
}
}
return transpose;
};
function deviation() {
var v = variance.apply(this, arguments);
return v ? Math.sqrt(v) : v;
};
function length(d) {
return d.length;
}
function descending(a, b) {
return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
function values(map) {
var values = [];
for (var key in map) values.push(map[key]);
return values;
};
function bisector(compare) {
if (compare.length === 1) compare = ascendingComparator(compare);
return {
left: function(a, x, lo, hi) {
if (arguments.length < 3) lo = 0;
if (arguments.length < 4) hi = a.length;
while (lo < hi) {
var mid = lo + hi >>> 1;
if (compare(a[mid], x) < 0) lo = mid + 1;
else hi = mid;
}
return lo;
},
right: function(a, x, lo, hi) {
if (arguments.length < 3) lo = 0;
if (arguments.length < 4) hi = a.length;
while (lo < hi) {
var mid = lo + hi >>> 1;
if (compare(a[mid], x) > 0) hi = mid;
else lo = mid + 1;
}
return lo;
}
};
function zip() {
return transpose(arguments);
};
function ascendingComparator(f) {
return function(d, x) {
return ascending(f(d), x);
};
}
var ascendingBisect = bisector(ascending);
var bisectRight = ascendingBisect.right;
var bisectLeft = ascendingBisect.left;
exports.ascending = ascending;
exports.bisect = bisectRight;
exports.bisectRight = bisectRight;
exports.bisectLeft = bisectLeft;
exports.bisectRight = bisectRight;
exports.ascending = ascending;
exports.bisector = bisector;

@@ -522,13 +528,13 @@ exports.descending = descending;

exports.min = min;
exports.nest = nest$1;
exports.pairs = pairs$1;
exports.nest = nest;
exports.pairs = pairs;
exports.permute = permute;
exports.quantile = quantile;
exports.range = range$1;
exports.range = range;
exports.set = set;
exports.shuffle = shuffle;
exports.sum = sum;
exports.transpose = transpose$1;
exports.values = values$1;
exports.transpose = transpose;
exports.values = values;
exports.variance = variance;
exports.zip = zip;
exports.zip = zip;

@@ -1,42 +0,46 @@

(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
factory((global.arrays = {}));
}(this, function (exports) { 'use strict';
!function(global, exports) {
"use strict";
function min(array, f) {
var i = -1,
n = array.length,
a,
b;
if (arguments.length === 1) {
while (++i < n) if ((b = array[i]) != null && b >= b) { a = b; break; }
while (++i < n) if ((b = array[i]) != null && a > b) a = b;
}
else {
while (++i < n) if ((b = f.call(array, array[i], i)) != null && b >= b) { a = b; break; }
while (++i < n) if ((b = f.call(array, array[i], i)) != null && a > b) a = b;
}
return a;
function ascending(a, b) {
return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
};
function transpose$1(matrix) {
if (!(n = matrix.length)) return [];
for (var i = -1, m = min(matrix, length), transpose = new Array(m); ++i < m;) {
for (var j = -1, n, row = transpose[i] = new Array(n); ++j < n;) {
row[j] = matrix[j][i];
function bisector(compare) {
if (compare.length === 1) compare = ascendingComparator(compare);
return {
left: function(a, x, lo, hi) {
if (arguments.length < 3) lo = 0;
if (arguments.length < 4) hi = a.length;
while (lo < hi) {
var mid = lo + hi >>> 1;
if (compare(a[mid], x) < 0) lo = mid + 1;
else hi = mid;
}
return lo;
},
right: function(a, x, lo, hi) {
if (arguments.length < 3) lo = 0;
if (arguments.length < 4) hi = a.length;
while (lo < hi) {
var mid = lo + hi >>> 1;
if (compare(a[mid], x) > 0) hi = mid;
else lo = mid + 1;
}
return lo;
}
}
return transpose;
};
};
function length(d) {
return d.length;
function ascendingComparator(f) {
return function(d, x) {
return ascending(f(d), x);
};
}
function zip() {
return transpose$1(arguments);
var ascendingBisect = bisector(ascending);
var bisectRight = ascendingBisect.right;
var bisectLeft = ascendingBisect.left;
function descending(a, b) {
return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
};

@@ -80,43 +84,43 @@

function values$1(map) {
var values = [];
for (var key in map) values.push(map[key]);
return values;
function deviation() {
var v = variance.apply(this, arguments);
return v ? Math.sqrt(v) : v;
};
function sum(array, f) {
var s = 0,
function entries(map) {
var entries = [];
for (var key in map) entries.push({key: key, value: map[key]});
return entries;
};
function extent(array, f) {
var i = -1,
n = array.length,
a,
i = -1;
b,
c;
if (arguments.length === 1) {
while (++i < n) if (!isNaN(a = +array[i])) s += a; // Note: zero and null are equivalent.
while (++i < n) if ((b = array[i]) != null && b >= b) { a = c = b; break; }
while (++i < n) if ((b = array[i]) != null) {
if (a > b) a = b;
if (c < b) c = b;
}
}
else {
while (++i < n) if (!isNaN(a = +f.call(array, array[i], i))) s += a;
while (++i < n) if ((b = f.call(array, array[i], i)) != null && b >= b) { a = c = b; break; }
while (++i < n) if ((b = f.call(array, array[i], i)) != null) {
if (a > b) a = b;
if (c < b) c = b;
}
}
return s;
return [a, c];
};
function shuffle(array, i0, i1) {
if ((m = arguments.length) < 3) {
i1 = array.length;
if (m < 2) i0 = 0;
}
var m = i1 - i0,
t,
i;
while (m) {
i = Math.random() * m-- | 0;
t = array[m + i0];
array[m + i0] = array[i + i0];
array[i + i0] = t;
}
return array;
function keys(map) {
var keys = [];
for (var key in map) keys.push(key);
return keys;
};

@@ -166,4 +170,4 @@

},
forEach: function(f) {
for (var property in this) if (property[0] === prefix) f.call(this, property.slice(1), this[property]);
each: function(f) {
for (var property in this) if (property[0] === prefix) f.call(this, this[property], property.slice(1));
}

@@ -176,3 +180,3 @@ };

// Copy constructor.
if (object instanceof Map) object.forEach(function(key, value) { map.set(key, value); });
if (object instanceof Map) object.each(function(value, key) { map.set(key, value); });

@@ -190,3 +194,3 @@ // Index array by numeric index or specified key function.

// Convert object to map.
else for (var key in object) map.set(key, object[key]);
else if (object) for (var key in object) map.set(key, object[key]);

@@ -196,46 +200,37 @@ return map;

function Set() {}
function max(array, f) {
var i = -1,
n = array.length,
a,
b;
var proto = map.prototype;
if (arguments.length === 1) {
while (++i < n) if ((b = array[i]) != null && b >= b) { a = b; break; }
while (++i < n) if ((b = array[i]) != null && b > a) a = b;
}
Set.prototype = set.prototype = {
has: proto.has,
add: function(value) {
value += "";
this[prefix + value] = true;
return value;
},
remove: proto.remove,
values: proto.keys,
size: proto.size,
empty: proto.empty,
forEach: function(f) {
for (var property in this) if (property[0] === prefix) f.call(this, property.slice(1));
else {
while (++i < n) if ((b = f.call(array, array[i], i)) != null && b >= b) { a = b; break; }
while (++i < n) if ((b = f.call(array, array[i], i)) != null && b > a) a = b;
}
return a;
};
function set(array) {
var set = new Set;
if (array) for (var i = 0, n = array.length; i < n; ++i) set.add(array[i]);
return set;
}
function mean(array, f) {
var s = 0,
n = array.length,
a,
i = -1,
j = n;
function range$1(start, stop, step) {
if ((n = arguments.length) < 3) {
step = 1;
if (n < 2) {
stop = start;
start = 0;
}
if (arguments.length === 1) {
while (++i < n) if (!isNaN(a = number(array[i]))) s += a; else --j;
}
var i = -1,
n = Math.max(0, Math.ceil((stop - start) / step)) | 0,
range = new Array(n);
while (++i < n) {
range[i] = start + i * step;
else {
while (++i < n) if (!isNaN(a = number(f.call(array, array[i], i)))) s += a; else --j;
}
return range;
if (j) return s / j;
};

@@ -252,15 +247,61 @@

function permute(array, indexes) {
var i = indexes.length, permutes = new Array(i);
while (i--) permutes[i] = array[indexes[i]];
return permutes;
function median(array, f) {
var numbers = [],
n = array.length,
a,
i = -1;
if (arguments.length === 1) {
while (++i < n) if (!isNaN(a = number(array[i]))) numbers.push(a);
}
else {
while (++i < n) if (!isNaN(a = number(f.call(array, array[i], i)))) numbers.push(a);
}
if (numbers.length) return quantile(numbers.sort(ascending), .5);
};
function pairs$1(array) {
var i = 0, n = array.length - 1, p0, p1 = array[0], pairs = new Array(n < 0 ? 0 : n);
while (i < n) pairs[i] = [p0 = p1, p1 = array[++i]];
return pairs;
function merge(arrays) {
var n = arrays.length,
m,
i = -1,
j = 0,
merged,
array;
while (++i < n) j += arrays[i].length;
merged = new Array(j);
while (--n >= 0) {
array = arrays[n];
m = array.length;
while (--m >= 0) {
merged[--j] = array[m];
}
}
return merged;
};
function nest$1() {
function min(array, f) {
var i = -1,
n = array.length,
a,
b;
if (arguments.length === 1) {
while (++i < n) if ((b = array[i]) != null && b >= b) { a = b; break; }
while (++i < n) if ((b = array[i]) != null && a > b) a = b;
}
else {
while (++i < n) if ((b = f.call(array, array[i], i)) != null && b >= b) { a = b; break; }
while (++i < n) if ((b = f.call(array, array[i], i)) != null && a > b) a = b;
}
return a;
};
function nest() {
var keys = [],

@@ -295,3 +336,3 @@ sortKeys = [],

valuesByKey.forEach(function(key, values) {
valuesByKey.each(function(values, key) {
setResult(result, key, apply(values, depth, createResult, setResult));

@@ -309,3 +350,3 @@ });

map.forEach(function(key, value) {
map.each(function(value, key) {
array.push({key: key, values: entries(value, depth)});

@@ -346,169 +387,131 @@ });

function merge(arrays) {
var n = arrays.length,
m,
i = -1,
j = 0,
merged,
array;
function pairs(array) {
var i = 0, n = array.length - 1, p0, p1 = array[0], pairs = new Array(n < 0 ? 0 : n);
while (i < n) pairs[i] = [p0 = p1, p1 = array[++i]];
return pairs;
};
while (++i < n) j += arrays[i].length;
merged = new Array(j);
function permute(array, indexes) {
var i = indexes.length, permutes = new Array(i);
while (i--) permutes[i] = array[indexes[i]];
return permutes;
};
while (--n >= 0) {
array = arrays[n];
m = array.length;
while (--m >= 0) {
merged[--j] = array[m];
function range(start, stop, step) {
if ((n = arguments.length) < 3) {
step = 1;
if (n < 2) {
stop = start;
start = 0;
}
}
return merged;
};
var i = -1,
n = Math.max(0, Math.ceil((stop - start) / step)) | 0,
range = new Array(n);
function ascending(a, b) {
return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
while (++i < n) {
range[i] = start + i * step;
}
return range;
};
function median(array, f) {
var numbers = [],
n = array.length,
a,
i = -1;
function Set() {}
if (arguments.length === 1) {
while (++i < n) if (!isNaN(a = number(array[i]))) numbers.push(a);
}
var proto = map.prototype;
else {
while (++i < n) if (!isNaN(a = number(f.call(array, array[i], i)))) numbers.push(a);
Set.prototype = set.prototype = {
has: proto.has,
add: function(value) {
value += "";
this[prefix + value] = true;
return value;
},
remove: proto.remove,
values: proto.keys,
size: proto.size,
empty: proto.empty,
each: function(f) {
for (var property in this) if (property[0] === prefix) f.call(this, property.slice(1));
}
if (numbers.length) return quantile(numbers.sort(ascending), .5);
};
function mean(array, f) {
var s = 0,
n = array.length,
a,
i = -1,
j = n;
function set(object) {
var set = new Set;
if (arguments.length === 1) {
while (++i < n) if (!isNaN(a = number(array[i]))) s += a; else --j;
}
// Copy constructor.
if (object instanceof Set) object.each(function(value) { set.add(value); });
else {
while (++i < n) if (!isNaN(a = number(f.call(array, array[i], i)))) s += a; else --j;
}
// Otherwise, assume it’s an array.
else if (object) for (var i = 0, n = object.length; i < n; ++i) set.add(object[i]);
if (j) return s / j;
};
return set;
}
function max(array, f) {
var i = -1,
n = array.length,
a,
b;
if (arguments.length === 1) {
while (++i < n) if ((b = array[i]) != null && b >= b) { a = b; break; }
while (++i < n) if ((b = array[i]) != null && b > a) a = b;
function shuffle(array, i0, i1) {
if ((m = arguments.length) < 3) {
i1 = array.length;
if (m < 2) i0 = 0;
}
else {
while (++i < n) if ((b = f.call(array, array[i], i)) != null && b >= b) { a = b; break; }
while (++i < n) if ((b = f.call(array, array[i], i)) != null && b > a) a = b;
var m = i1 - i0,
t,
i;
while (m) {
i = Math.random() * m-- | 0;
t = array[m + i0];
array[m + i0] = array[i + i0];
array[i + i0] = t;
}
return a;
return array;
};
function keys(map) {
var keys = [];
for (var key in map) keys.push(key);
return keys;
};
function extent(array, f) {
var i = -1,
function sum(array, f) {
var s = 0,
n = array.length,
a,
b,
c;
i = -1;
if (arguments.length === 1) {
while (++i < n) if ((b = array[i]) != null && b >= b) { a = c = b; break; }
while (++i < n) if ((b = array[i]) != null) {
if (a > b) a = b;
if (c < b) c = b;
}
while (++i < n) if (!isNaN(a = +array[i])) s += a; // Note: zero and null are equivalent.
}
else {
while (++i < n) if ((b = f.call(array, array[i], i)) != null && b >= b) { a = c = b; break; }
while (++i < n) if ((b = f.call(array, array[i], i)) != null) {
if (a > b) a = b;
if (c < b) c = b;
}
while (++i < n) if (!isNaN(a = +f.call(array, array[i], i))) s += a;
}
return [a, c];
return s;
};
function entries(map) {
var entries = [];
for (var key in map) entries.push({key: key, value: map[key]});
return entries;
function transpose(matrix) {
if (!(n = matrix.length)) return [];
for (var i = -1, m = min(matrix, length), transpose = new Array(m); ++i < m;) {
for (var j = -1, n, row = transpose[i] = new Array(n); ++j < n;) {
row[j] = matrix[j][i];
}
}
return transpose;
};
function deviation() {
var v = variance.apply(this, arguments);
return v ? Math.sqrt(v) : v;
};
function length(d) {
return d.length;
}
function descending(a, b) {
return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
function values(map) {
var values = [];
for (var key in map) values.push(map[key]);
return values;
};
function bisector(compare) {
if (compare.length === 1) compare = ascendingComparator(compare);
return {
left: function(a, x, lo, hi) {
if (arguments.length < 3) lo = 0;
if (arguments.length < 4) hi = a.length;
while (lo < hi) {
var mid = lo + hi >>> 1;
if (compare(a[mid], x) < 0) lo = mid + 1;
else hi = mid;
}
return lo;
},
right: function(a, x, lo, hi) {
if (arguments.length < 3) lo = 0;
if (arguments.length < 4) hi = a.length;
while (lo < hi) {
var mid = lo + hi >>> 1;
if (compare(a[mid], x) > 0) hi = mid;
else lo = mid + 1;
}
return lo;
}
};
function zip() {
return transpose(arguments);
};
function ascendingComparator(f) {
return function(d, x) {
return ascending(f(d), x);
};
}
var ascendingBisect = bisector(ascending);
var bisectRight = ascendingBisect.right;
var bisectLeft = ascendingBisect.left;
exports.ascending = ascending;
exports.bisect = bisectRight;
exports.bisectRight = bisectRight;
exports.bisectLeft = bisectLeft;
exports.bisectRight = bisectRight;
exports.ascending = ascending;
exports.bisector = bisector;

@@ -526,15 +529,19 @@ exports.descending = descending;

exports.min = min;
exports.nest = nest$1;
exports.pairs = pairs$1;
exports.nest = nest;
exports.pairs = pairs;
exports.permute = permute;
exports.quantile = quantile;
exports.range = range$1;
exports.range = range;
exports.set = set;
exports.shuffle = shuffle;
exports.sum = sum;
exports.transpose = transpose$1;
exports.values = values$1;
exports.transpose = transpose;
exports.values = values;
exports.variance = variance;
exports.zip = zip;
exports.version = "0.2.0";
}));
if (typeof define === "function" && define.amd) global.arrays = exports, define("arrays", [], function() { return exports; });
else if (typeof module === "object" && module.exports) module.exports = exports;
else global.arrays = exports;
}(this, {});

@@ -1,1 +0,1 @@

!function(n,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r(n.arrays={})}(this,function(n){"use strict";function r(n,r){var t,e,u=-1,i=n.length;if(1===arguments.length){for(;++u<i;)if(null!=(e=n[u])&&e>=e){t=e;break}for(;++u<i;)null!=(e=n[u])&&t>e&&(t=e)}else{for(;++u<i;)if(null!=(e=r.call(n,n[u],u))&&e>=e){t=e;break}for(;++u<i;)null!=(e=r.call(n,n[u],u))&&t>e&&(t=e)}return t}function t(n){if(!(o=n.length))return[];for(var t=-1,u=r(n,e),i=new Array(u);++t<u;)for(var o,f=-1,a=i[t]=new Array(o);++f<o;)a[f]=n[f][t];return i}function e(n){return n.length}function u(){return t(arguments)}function i(n){return null===n?NaN:+n}function o(n,r){var t,e,u=n.length,o=0,f=0,a=-1,l=0;if(1===arguments.length)for(;++a<u;)isNaN(t=i(n[a]))||(e=t-o,o+=e/++l,f+=e*(t-o));else for(;++a<u;)isNaN(t=i(r.call(n,n[a],a)))||(e=t-o,o+=e/++l,f+=e*(t-o));return l>1?f/(l-1):void 0}function f(n){var r=[];for(var t in n)r.push(n[t]);return r}function a(n,r){var t,e=0,u=n.length,i=-1;if(1===arguments.length)for(;++i<u;)isNaN(t=+n[i])||(e+=t);else for(;++i<u;)isNaN(t=+r.call(n,n[i],i))||(e+=t);return e}function l(n,r,t){(i=arguments.length)<3&&(t=n.length,2>i&&(r=0));for(var e,u,i=t-r;i;)u=Math.random()*i--|0,e=n[i+r],n[i+r]=n[u+r],n[u+r]=e;return n}function s(){}function c(n,r){var t=new s;if(n instanceof s)n.forEach(function(n,r){t.set(n,r)});else if(Array.isArray(n)){var e,u=-1,i=n.length;if(1===arguments.length)for(;++u<i;)t.set(u,n[u]);else for(;++u<i;)t.set(r.call(n,e=n[u],u),e)}else for(var o in n)t.set(o,n[o]);return t}function h(){}function g(n){var r=new h;if(n)for(var t=0,e=n.length;e>t;++t)r.add(n[t]);return r}function v(n,r,t){(u=arguments.length)<3&&(t=1,2>u&&(r=n,n=0));for(var e=-1,u=0|Math.max(0,Math.ceil((r-n)/t)),i=new Array(u);++e<u;)i[e]=n+e*t;return i}function p(n,r){var t=(n.length-1)*r+1,e=Math.floor(t),u=+n[e-1],i=t-e;return i?u+i*(n[e]-u):u}function m(n,r){for(var t=r.length,e=new Array(t);t--;)e[t]=n[r[t]];return e}function y(n){for(var r,t=0,e=n.length-1,u=n[0],i=new Array(0>e?0:e);e>t;)i[t]=[r=u,u=n[++t]];return i}function N(){function n(r,o,f,a){if(o>=i.length)return e?e.call(u,r):t?r.sort(t):r;for(var l,s,h,g=-1,v=r.length,p=i[o++],m=c(),y=f();++g<v;)(h=m.get(l=p(s=r[g])+""))?h.push(s):m.set(l,[s]);return m.forEach(function(r,t){a(y,r,n(t,o,f,a))}),y}function r(n,t){if(t>=i.length)return n;var e=[],u=o[t++];return n.forEach(function(n,u){e.push({key:n,values:r(u,t)})}),u?e.sort(function(n,r){return u(n.key,r.key)}):e}var t,e,u,i=[],o=[];return u={object:function(r){return n(r,0,d,k)},map:function(r){return n(r,0,b,w)},entries:function(t){return r(n(t,0,b,w),0)},key:function(n){return i.push(n),u},sortKeys:function(n){return o[i.length-1]=n,u},sortValues:function(n){return t=n,u},rollup:function(n){return e=n,u}}}function d(){return{}}function k(n,r,t){n[r]=t}function b(){return c()}function w(n,r,t){n.set(r,t)}function A(n){for(var r,t,e,u=n.length,i=-1,o=0;++i<u;)o+=n[i].length;for(t=new Array(o);--u>=0;)for(e=n[u],r=e.length;--r>=0;)t[--o]=e[r];return t}function x(n,r){return r>n?-1:n>r?1:n>=r?0:NaN}function E(n,r){var t,e=[],u=n.length,o=-1;if(1===arguments.length)for(;++o<u;)isNaN(t=i(n[o]))||e.push(t);else for(;++o<u;)isNaN(t=i(r.call(n,n[o],o)))||e.push(t);return e.length?p(e.sort(x),.5):void 0}function M(n,r){var t,e=0,u=n.length,o=-1,f=u;if(1===arguments.length)for(;++o<u;)isNaN(t=i(n[o]))?--f:e+=t;else for(;++o<u;)isNaN(t=i(r.call(n,n[o],o)))?--f:e+=t;return f?e/f:void 0}function z(n,r){var t,e,u=-1,i=n.length;if(1===arguments.length){for(;++u<i;)if(null!=(e=n[u])&&e>=e){t=e;break}for(;++u<i;)null!=(e=n[u])&&e>t&&(t=e)}else{for(;++u<i;)if(null!=(e=r.call(n,n[u],u))&&e>=e){t=e;break}for(;++u<i;)null!=(e=r.call(n,n[u],u))&&e>t&&(t=e)}return t}function j(n){var r=[];for(var t in n)r.push(t);return r}function q(n,r){var t,e,u,i=-1,o=n.length;if(1===arguments.length){for(;++i<o;)if(null!=(e=n[i])&&e>=e){t=u=e;break}for(;++i<o;)null!=(e=n[i])&&(t>e&&(t=e),e>u&&(u=e))}else{for(;++i<o;)if(null!=(e=r.call(n,n[i],i))&&e>=e){t=u=e;break}for(;++i<o;)null!=(e=r.call(n,n[i],i))&&(t>e&&(t=e),e>u&&(u=e))}return[t,u]}function K(n){var r=[];for(var t in n)r.push({key:t,value:n[t]});return r}function L(){var n=o.apply(this,arguments);return n?Math.sqrt(n):n}function R(n,r){return n>r?-1:r>n?1:r>=n?0:NaN}function V(n){return 1===n.length&&(n=$(n)),{left:function(r,t,e,u){for(arguments.length<3&&(e=0),arguments.length<4&&(u=r.length);u>e;){var i=e+u>>>1;n(r[i],t)<0?e=i+1:u=i}return e},right:function(r,t,e,u){for(arguments.length<3&&(e=0),arguments.length<4&&(u=r.length);u>e;){var i=e+u>>>1;n(r[i],t)>0?u=i:e=i+1}return e}}}function $(n){return function(r,t){return x(n(r),t)}}var B="$";s.prototype=c.prototype={has:function(n){return B+n in this},get:function(n){return this[B+n]},set:function(n,r){return this[B+n]=r},remove:function(n){var r=B+n;return r in this&&delete this[r]},keys:function(){var n=[];for(var r in this)r[0]===B&&n.push(r.slice(1));return n},values:function(){var n=[];for(var r in this)r[0]===B&&n.push(this[r]);return n},entries:function(){var n=[];for(var r in this)r[0]===B&&n.push({key:r.slice(1),value:this[r]});return n},size:function(){var n=0;for(var r in this)r[0]===B&&++n;return n},empty:function(){for(var n in this)if(n[0]===B)return!1;return!0},forEach:function(n){for(var r in this)r[0]===B&&n.call(this,r.slice(1),this[r])}};var C=c.prototype;h.prototype=g.prototype={has:C.has,add:function(n){return n+="",this[B+n]=!0,n},remove:C.remove,values:C.keys,size:C.size,empty:C.empty,forEach:function(n){for(var r in this)r[0]===B&&n.call(this,r.slice(1))}};var D=V(x),F=D.right,G=D.left;n.ascending=x,n.bisect=F,n.bisectLeft=G,n.bisectRight=F,n.bisector=V,n.descending=R,n.deviation=L,n.entries=K,n.extent=q,n.keys=j,n.map=c,n.max=z,n.mean=M,n.median=E,n.merge=A,n.min=r,n.nest=N,n.pairs=y,n.permute=m,n.quantile=p,n.range=v,n.set=g,n.shuffle=l,n.sum=a,n.transpose=t,n.values=f,n.variance=o,n.zip=u});
!function(n,r){"use strict";function t(n,r){return r>n?-1:n>r?1:n>=r?0:NaN}function e(n){return 1===n.length&&(n=u(n)),{left:function(r,t,e,u){for(arguments.length<3&&(e=0),arguments.length<4&&(u=r.length);u>e;){var i=e+u>>>1;n(r[i],t)<0?e=i+1:u=i}return e},right:function(r,t,e,u){for(arguments.length<3&&(e=0),arguments.length<4&&(u=r.length);u>e;){var i=e+u>>>1;n(r[i],t)>0?u=i:e=i+1}return e}}}function u(n){return function(r,e){return t(n(r),e)}}function i(n,r){return n>r?-1:r>n?1:r>=n?0:NaN}function o(n){return null===n?NaN:+n}function a(n,r){var t,e,u=n.length,i=0,a=0,f=-1,l=0;if(1===arguments.length)for(;++f<u;)isNaN(t=o(n[f]))||(e=t-i,i+=e/++l,a+=e*(t-i));else for(;++f<u;)isNaN(t=o(r.call(n,n[f],f)))||(e=t-i,i+=e/++l,a+=e*(t-i));return l>1?a/(l-1):void 0}function f(){var n=a.apply(this,arguments);return n?Math.sqrt(n):n}function l(n){var r=[];for(var t in n)r.push({key:t,value:n[t]});return r}function s(n,r){var t,e,u,i=-1,o=n.length;if(1===arguments.length){for(;++i<o;)if(null!=(e=n[i])&&e>=e){t=u=e;break}for(;++i<o;)null!=(e=n[i])&&(t>e&&(t=e),e>u&&(u=e))}else{for(;++i<o;)if(null!=(e=r.call(n,n[i],i))&&e>=e){t=u=e;break}for(;++i<o;)null!=(e=r.call(n,n[i],i))&&(t>e&&(t=e),e>u&&(u=e))}return[t,u]}function c(n){var r=[];for(var t in n)r.push(t);return r}function h(){}function g(n,r){var t=new h;if(n instanceof h)n.each(function(n,r){t.set(r,n)});else if(Array.isArray(n)){var e,u=-1,i=n.length;if(1===arguments.length)for(;++u<i;)t.set(u,n[u]);else for(;++u<i;)t.set(r.call(n,e=n[u],u),e)}else if(n)for(var o in n)t.set(o,n[o]);return t}function v(n,r){var t,e,u=-1,i=n.length;if(1===arguments.length){for(;++u<i;)if(null!=(e=n[u])&&e>=e){t=e;break}for(;++u<i;)null!=(e=n[u])&&e>t&&(t=e)}else{for(;++u<i;)if(null!=(e=r.call(n,n[u],u))&&e>=e){t=e;break}for(;++u<i;)null!=(e=r.call(n,n[u],u))&&e>t&&(t=e)}return t}function m(n,r){var t,e=0,u=n.length,i=-1,a=u;if(1===arguments.length)for(;++i<u;)isNaN(t=o(n[i]))?--a:e+=t;else for(;++i<u;)isNaN(t=o(r.call(n,n[i],i)))?--a:e+=t;return a?e/a:void 0}function p(n,r){var t=(n.length-1)*r+1,e=Math.floor(t),u=+n[e-1],i=t-e;return i?u+i*(n[e]-u):u}function y(n,r){var e,u=[],i=n.length,a=-1;if(1===arguments.length)for(;++a<i;)isNaN(e=o(n[a]))||u.push(e);else for(;++a<i;)isNaN(e=o(r.call(n,n[a],a)))||u.push(e);return u.length?p(u.sort(t),.5):void 0}function d(n){for(var r,t,e,u=n.length,i=-1,o=0;++i<u;)o+=n[i].length;for(t=new Array(o);--u>=0;)for(e=n[u],r=e.length;--r>=0;)t[--o]=e[r];return t}function N(n,r){var t,e,u=-1,i=n.length;if(1===arguments.length){for(;++u<i;)if(null!=(e=n[u])&&e>=e){t=e;break}for(;++u<i;)null!=(e=n[u])&&t>e&&(t=e)}else{for(;++u<i;)if(null!=(e=r.call(n,n[u],u))&&e>=e){t=e;break}for(;++u<i;)null!=(e=r.call(n,n[u],u))&&t>e&&(t=e)}return t}function k(){function n(r,o,a,f){if(o>=i.length)return e?e.call(u,r):t?r.sort(t):r;for(var l,s,c,h=-1,v=r.length,m=i[o++],p=g(),y=a();++h<v;)(c=p.get(l=m(s=r[h])+""))?c.push(s):p.set(l,[s]);return p.each(function(r,t){f(y,t,n(r,o,a,f))}),y}function r(n,t){if(t>=i.length)return n;var e=[],u=o[t++];return n.each(function(n,u){e.push({key:u,values:r(n,t)})}),u?e.sort(function(n,r){return u(n.key,r.key)}):e}var t,e,u,i=[],o=[];return u={object:function(r){return n(r,0,b,w)},map:function(r){return n(r,0,A,x)},entries:function(t){return r(n(t,0,A,x),0)},key:function(n){return i.push(n),u},sortKeys:function(n){return o[i.length-1]=n,u},sortValues:function(n){return t=n,u},rollup:function(n){return e=n,u}}}function b(){return{}}function w(n,r,t){n[r]=t}function A(){return g()}function x(n,r,t){n.set(r,t)}function M(n){for(var r,t=0,e=n.length-1,u=n[0],i=new Array(0>e?0:e);e>t;)i[t]=[r=u,u=n[++t]];return i}function z(n,r){for(var t=r.length,e=new Array(t);t--;)e[t]=n[r[t]];return e}function j(n,r,t){(u=arguments.length)<3&&(t=1,2>u&&(r=n,n=0));for(var e=-1,u=0|Math.max(0,Math.ceil((r-n)/t)),i=new Array(u);++e<u;)i[e]=n+e*t;return i}function q(){}function K(n){var r=new q;if(n instanceof q)n.each(function(n){r.add(n)});else if(n)for(var t=0,e=n.length;e>t;++t)r.add(n[t]);return r}function L(n,r,t){(i=arguments.length)<3&&(t=n.length,2>i&&(r=0));for(var e,u,i=t-r;i;)u=Math.random()*i--|0,e=n[i+r],n[i+r]=n[u+r],n[u+r]=e;return n}function R(n,r){var t,e=0,u=n.length,i=-1;if(1===arguments.length)for(;++i<u;)isNaN(t=+n[i])||(e+=t);else for(;++i<u;)isNaN(t=+r.call(n,n[i],i))||(e+=t);return e}function V(n){if(!(u=n.length))return[];for(var r=-1,t=N(n,$),e=new Array(t);++r<t;)for(var u,i=-1,o=e[r]=new Array(u);++i<u;)o[i]=n[i][r];return e}function $(n){return n.length}function B(n){var r=[];for(var t in n)r.push(n[t]);return r}function C(){return V(arguments)}var D=e(t),E=D.right,F=D.left,G="$";h.prototype=g.prototype={has:function(n){return G+n in this},get:function(n){return this[G+n]},set:function(n,r){return this[G+n]=r},remove:function(n){var r=G+n;return r in this&&delete this[r]},keys:function(){var n=[];for(var r in this)r[0]===G&&n.push(r.slice(1));return n},values:function(){var n=[];for(var r in this)r[0]===G&&n.push(this[r]);return n},entries:function(){var n=[];for(var r in this)r[0]===G&&n.push({key:r.slice(1),value:this[r]});return n},size:function(){var n=0;for(var r in this)r[0]===G&&++n;return n},empty:function(){for(var n in this)if(n[0]===G)return!1;return!0},each:function(n){for(var r in this)r[0]===G&&n.call(this,this[r],r.slice(1))}};var H=g.prototype;q.prototype=K.prototype={has:H.has,add:function(n){return n+="",this[G+n]=!0,n},remove:H.remove,values:H.keys,size:H.size,empty:H.empty,each:function(n){for(var r in this)r[0]===G&&n.call(this,r.slice(1))}},r.bisect=E,r.bisectRight=E,r.bisectLeft=F,r.ascending=t,r.bisector=e,r.descending=i,r.deviation=f,r.entries=l,r.extent=s,r.keys=c,r.map=g,r.max=v,r.mean=m,r.median=y,r.merge=d,r.min=N,r.nest=k,r.pairs=M,r.permute=z,r.quantile=p,r.range=j,r.set=K,r.shuffle=L,r.sum=R,r.transpose=V,r.values=B,r.variance=a,r.zip=C,r.version="0.2.0","function"==typeof define&&define.amd?(n.arrays=r,define("arrays",[],function(){return r})):"object"==typeof module&&module.exports?module.exports=r:n.arrays=r}(this,{});

@@ -1,57 +0,26 @@

import ascending from "./src/ascending";
import {default as bisect, bisectRight, bisectLeft} from "./src/bisect";
import bisector from "./src/bisector";
import descending from "./src/descending";
import deviation from "./src/deviation";
import entries from "./src/entries";
import extent from "./src/extent";
import keys from "./src/keys";
import map from "./src/map";
import max from "./src/max";
import mean from "./src/mean";
import median from "./src/median";
import merge from "./src/merge";
import min from "./src/min";
import nest from "./src/nest";
import pairs from "./src/pairs";
import permute from "./src/permute";
import quantile from "./src/quantile";
import range from "./src/range";
import set from "./src/set";
import shuffle from "./src/shuffle";
import sum from "./src/sum";
import transpose from "./src/transpose";
import values from "./src/values";
import variance from "./src/variance";
import zip from "./src/zip";
export {
ascending,
bisect,
bisectLeft,
bisectRight,
bisector,
descending,
deviation,
entries,
extent,
keys,
map,
max,
mean,
median,
merge,
min,
nest,
pairs,
permute,
quantile,
range,
set,
shuffle,
sum,
transpose,
values,
variance,
zip
};
export {default as bisect, bisectRight, bisectLeft} from "./src/bisect";
export {default as ascending} from "./src/ascending";
export {default as bisector} from "./src/bisector";
export {default as descending} from "./src/descending";
export {default as deviation} from "./src/deviation";
export {default as entries} from "./src/entries";
export {default as extent} from "./src/extent";
export {default as keys} from "./src/keys";
export {default as map} from "./src/map";
export {default as max} from "./src/max";
export {default as mean} from "./src/mean";
export {default as median} from "./src/median";
export {default as merge} from "./src/merge";
export {default as min} from "./src/min";
export {default as nest} from "./src/nest";
export {default as pairs} from "./src/pairs";
export {default as permute} from "./src/permute";
export {default as quantile} from "./src/quantile";
export {default as range} from "./src/range";
export {default as set} from "./src/set";
export {default as shuffle} from "./src/shuffle";
export {default as sum} from "./src/sum";
export {default as transpose} from "./src/transpose";
export {default as values} from "./src/values";
export {default as variance} from "./src/variance";
export {default as zip} from "./src/zip";
{
"name": "d3-arrays",
"version": "0.1.2",
"version": "0.2.0",
"description": "Array manipulation, ordering, searching, summarizing, etc.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -286,3 +286,3 @@ # d3-arrays

<a name="map_forEach" href="#map_forEach">#</a> <i>map</i>.<b>forEach</b>(<i>function</i>)
<a name="map_each" href="#map_each">#</a> <i>map</i>.<b>each</b>(<i>function</i>)

@@ -325,3 +325,3 @@ Calls the specified *function* for each entry in this map, passing the entry's key and value as two arguments. The `this` context of the *function* is this map. Returns undefined. The iteration order is arbitrary.

<a name="set_forEach" href="#set_forEach">#</a> <i>set</i>.<b>forEach</b>(<i>function</i>)
<a name="set_each" href="#set_each">#</a> <i>set</i>.<b>each</b>(<i>function</i>)

@@ -328,0 +328,0 @@ Calls the specified *function* for each value in this set, passing the value as an argument. The `this` context of the *function* is this set. Returns undefined. The iteration order is arbitrary.

@@ -43,4 +43,4 @@ export var prefix = "$";

},
forEach: function(f) {
for (var property in this) if (property[0] === prefix) f.call(this, property.slice(1), this[property]);
each: function(f) {
for (var property in this) if (property[0] === prefix) f.call(this, this[property], property.slice(1));
}

@@ -53,3 +53,3 @@ };

// Copy constructor.
if (object instanceof Map) object.forEach(function(key, value) { map.set(key, value); });
if (object instanceof Map) object.each(function(value, key) { map.set(key, value); });

@@ -67,3 +67,3 @@ // Index array by numeric index or specified key function.

// Convert object to map.
else for (var key in object) map.set(key, object[key]);
else if (object) for (var key in object) map.set(key, object[key]);

@@ -70,0 +70,0 @@ return map;

@@ -33,3 +33,3 @@ import map from "./map";

valuesByKey.forEach(function(key, values) {
valuesByKey.each(function(values, key) {
setResult(result, key, apply(values, depth, createResult, setResult));

@@ -47,3 +47,3 @@ });

map.forEach(function(key, value) {
map.each(function(value, key) {
array.push({key: key, values: entries(value, depth)});

@@ -50,0 +50,0 @@ });

@@ -18,3 +18,3 @@ import {default as map, prefix} from "./map";

empty: proto.empty,
forEach: function(f) {
each: function(f) {
for (var property in this) if (property[0] === prefix) f.call(this, property.slice(1));

@@ -24,5 +24,11 @@ }

function set(array) {
function set(object) {
var set = new Set;
if (array) for (var i = 0, n = array.length; i < n; ++i) set.add(array[i]);
// Copy constructor.
if (object instanceof Set) object.each(function(value) { set.add(value); });
// Otherwise, assume it’s an array.
else if (object) for (var i = 0, n = object.length; i < n; ++i) set.add(object[i]);
return set;

@@ -29,0 +35,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc