Socket
Socket
Sign inDemoInstall

d3-array

Package Overview
Dependencies
1
Maintainers
2
Versions
61
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.12.1 to 3.0.0

src/mode.js

61

dist/d3-array.js

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

// https://d3js.org/d3-array/ v2.12.1 Copyright 2021 Mike Bostock
// https://d3js.org/d3-array/ v3.0.0 Copyright 2021 Mike Bostock
(function (global, factory) {

@@ -9,3 +9,7 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :

function ascending(a, b) {
return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
return a == null || b == null ? NaN
: a < b ? -1
: a > b ? 1
: a >= b ? 0
: NaN;
}

@@ -145,3 +149,7 @@

function descending(a, b) {
return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
return a == null || b == null ? NaN
: b < a ? -1
: b > a ? 1
: b >= a ? 0
: NaN;
}

@@ -354,2 +362,17 @@

function flatten$1(groups, keys) {
for (let i = 1, n = keys.length; i < n; ++i) {
groups = groups.flatMap(g => g.pop().map(([key, value]) => [...g, key, value]));
}
return groups;
}
function flatGroup(values, ...keys) {
return flatten$1(groups(values, ...keys), keys);
}
function flatRollup(values, reduce, ...keys) {
return flatten$1(rollups(values, reduce, ...keys), keys);
}
function rollup(values, reduce, ...keys) {

@@ -585,3 +608,3 @@ return nest(values, identity, reduce, keys);

x = values[i];
if (x0 <= x && x <= x1) {
if (x != null && x0 <= x && x <= x1) {
bins[bisectRight(tz, x, 0, m)].push(data[i]);

@@ -807,2 +830,29 @@ }

function mode(values, valueof) {
const counts = new InternMap();
if (valueof === undefined) {
for (let value of values) {
if (value != null && value >= value) {
counts.set(value, (counts.get(value) || 0) + 1);
}
}
} else {
let index = -1;
for (let value of values) {
if ((value = valueof(value, ++index, values)) != null && value >= value) {
counts.set(value, (counts.get(value) || 0) + 1);
}
}
}
let modeValue;
let modeCount = 0;
for (const [value, count] of counts) {
if (count > modeCount) {
modeCount = count;
modeValue = value;
}
}
return modeValue;
}
function pairs(values, pairof = pair) {

@@ -1135,2 +1185,4 @@ const pairs = [];

exports.filter = filter;
exports.flatGroup = flatGroup;
exports.flatRollup = flatRollup;
exports.fsum = fsum;

@@ -1156,2 +1208,3 @@ exports.greatest = greatest;

exports.minIndex = minIndex;
exports.mode = mode;
exports.nice = nice;

@@ -1158,0 +1211,0 @@ exports.pairs = pairs;

4

dist/d3-array.min.js

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

// https://d3js.org/d3-array/ v2.12.1 Copyright 2021 Mike Bostock
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).d3=t.d3||{})}(this,(function(t){"use strict";function n(t,n){return t<n?-1:t>n?1:t>=n?0:NaN}function r(t){let r=t,e=t;function o(t,n,r,o){for(null==r&&(r=0),null==o&&(o=t.length);r<o;){const f=r+o>>>1;e(t[f],n)<0?r=f+1:o=f}return r}return 1===t.length&&(r=(n,r)=>t(n)-r,e=function(t){return(r,e)=>n(t(r),e)}(t)),{left:o,center:function(t,n,e,f){null==e&&(e=0),null==f&&(f=t.length);const i=o(t,n,e,f-1);return i>e&&r(t[i-1],n)>-r(t[i],n)?i-1:i},right:function(t,n,r,o){for(null==r&&(r=0),null==o&&(o=t.length);r<o;){const f=r+o>>>1;e(t[f],n)>0?o=f:r=f+1}return r}}}function e(t){return null===t?NaN:+t}const o=r(n),f=o.right,i=o.left,u=r(e).center;function l(t,n){let r=0;if(void 0===n)for(let n of t)null!=n&&(n=+n)>=n&&++r;else{let e=-1;for(let o of t)null!=(o=n(o,++e,t))&&(o=+o)>=o&&++r}return r}function s(t){return 0|t.length}function c(t){return!(t>0)}function a(t){return"object"!=typeof t||"length"in t?t:Array.from(t)}function h(t,n){let r,e=0,o=0,f=0;if(void 0===n)for(let n of t)null!=n&&(n=+n)>=n&&(r=n-o,o+=r/++e,f+=r*(n-o));else{let i=-1;for(let u of t)null!=(u=n(u,++i,t))&&(u=+u)>=u&&(r=u-o,o+=r/++e,f+=r*(u-o))}if(e>1)return f/(e-1)}function d(t,n){const r=h(t,n);return r?Math.sqrt(r):r}function p(t,n){let r,e;if(void 0===n)for(const n of t)null!=n&&(void 0===r?n>=n&&(r=e=n):(r>n&&(r=n),e<n&&(e=n)));else{let o=-1;for(let f of t)null!=(f=n(f,++o,t))&&(void 0===r?f>=f&&(r=e=f):(r>f&&(r=f),e<f&&(e=f)))}return[r,e]}class y{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){const n=this._partials;let r=0;for(let e=0;e<this._n&&e<32;e++){const o=n[e],f=t+o,i=Math.abs(t)<Math.abs(o)?t-(f-o):o-(f-t);i&&(n[r++]=i),t=f}return n[r]=t,this._n=r+1,this}valueOf(){const t=this._partials;let n,r,e,o=this._n,f=0;if(o>0){for(f=t[--o];o>0&&(n=f,r=t[--o],f=n+r,e=r-(f-n),!e););o>0&&(e<0&&t[o-1]<0||e>0&&t[o-1]>0)&&(r=2*e,n=f+r,r==n-f&&(f=n))}return f}}class v extends Map{constructor(t,n=b){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),null!=t)for(const[n,r]of t)this.set(n,r)}get(t){return super.get(g(this,t))}has(t){return super.has(g(this,t))}set(t,n){return super.set(M(this,t),n)}delete(t){return super.delete(w(this,t))}}class m extends Set{constructor(t,n=b){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),null!=t)for(const n of t)this.add(n)}has(t){return super.has(g(this,t))}add(t){return super.add(M(this,t))}delete(t){return super.delete(w(this,t))}}function g({_intern:t,_key:n},r){const e=n(r);return t.has(e)?t.get(e):r}function M({_intern:t,_key:n},r){const e=n(r);return t.has(e)?t.get(e):(t.set(e,r),r)}function w({_intern:t,_key:n},r){const e=n(r);return t.has(e)&&(r=t.get(r),t.delete(e)),r}function b(t){return null!==t&&"object"==typeof t?t.valueOf():t}function A(t){return t}function x(t,...n){return k(t,A,A,n)}function S(t,n,...r){return k(t,A,n,r)}function _(t){if(1!==t.length)throw new Error("duplicate key");return t[0]}function k(t,n,r,e){return function t(o,f){if(f>=e.length)return r(o);const i=new v,u=e[f++];let l=-1;for(const t of o){const n=u(t,++l,o),r=i.get(n);r?r.push(t):i.set(n,[t])}for(const[n,r]of i)i.set(n,t(r,f));return n(i)}(t,0)}function T(t,n){return Array.from(n,(n=>t[n]))}function j(t,...r){if("function"!=typeof t[Symbol.iterator])throw new TypeError("values is not iterable");t=Array.from(t);let[e=n]=r;if(1===e.length||r.length>1){const o=Uint32Array.from(t,((t,n)=>n));return r.length>1?(r=r.map((n=>t.map(n))),o.sort(((t,e)=>{for(const o of r){const r=n(o[t],o[e]);if(r)return r}}))):(e=t.map(e),o.sort(((t,r)=>n(e[t],e[r])))),T(t,o)}return t.sort(e)}var E=Array.prototype.slice;function N(t){return function(){return t}}var q=Math.sqrt(50),F=Math.sqrt(10),I=Math.sqrt(2);function O(t,n,r){var e,o,f,i,u=-1;if(r=+r,(t=+t)===(n=+n)&&r>0)return[t];if((e=n<t)&&(o=t,t=n,n=o),0===(i=L(t,n,r))||!isFinite(i))return[];if(i>0){let r=Math.round(t/i),e=Math.round(n/i);for(r*i<t&&++r,e*i>n&&--e,f=new Array(o=e-r+1);++u<o;)f[u]=(r+u)*i}else{i=-i;let r=Math.round(t*i),e=Math.round(n*i);for(r/i<t&&++r,e/i>n&&--e,f=new Array(o=e-r+1);++u<o;)f[u]=(r+u)/i}return e&&f.reverse(),f}function L(t,n,r){var e=(n-t)/Math.max(0,r),o=Math.floor(Math.log(e)/Math.LN10),f=e/Math.pow(10,o);return o>=0?(f>=q?10:f>=F?5:f>=I?2:1)*Math.pow(10,o):-Math.pow(10,-o)/(f>=q?10:f>=F?5:f>=I?2:1)}function P(t,n,r){let e;for(;;){const o=L(t,n,r);if(o===e||0===o||!isFinite(o))return[t,n];o>0?(t=Math.floor(t/o)*o,n=Math.ceil(n/o)*o):o<0&&(t=Math.ceil(t*o)/o,n=Math.floor(n*o)/o),e=o}}function z(t){return Math.ceil(Math.log(l(t))/Math.LN2)+1}function C(){var t=A,n=p,r=z;function e(e){Array.isArray(e)||(e=Array.from(e));var o,i,u=e.length,l=new Array(u);for(o=0;o<u;++o)l[o]=t(e[o],o,e);var s=n(l),c=s[0],a=s[1],h=r(l,c,a);if(!Array.isArray(h)){const t=a,r=+h;if(n===p&&([c,a]=P(c,a,r)),(h=O(c,a,r))[h.length-1]>=a)if(t>=a&&n===p){const t=L(c,a,r);isFinite(t)&&(t>0?a=(Math.floor(a/t)+1)*t:t<0&&(a=(Math.ceil(a*-t)+1)/-t))}else h.pop()}for(var d=h.length;h[0]<=c;)h.shift(),--d;for(;h[d-1]>a;)h.pop(),--d;var y,v=new Array(d+1);for(o=0;o<=d;++o)(y=v[o]=[]).x0=o>0?h[o-1]:c,y.x1=o<d?h[o]:a;for(o=0;o<u;++o)c<=(i=l[o])&&i<=a&&v[f(h,i,0,d)].push(e[o]);return v}return e.value=function(n){return arguments.length?(t="function"==typeof n?n:N(n),e):t},e.domain=function(t){return arguments.length?(n="function"==typeof t?t:N([t[0],t[1]]),e):n},e.thresholds=function(t){return arguments.length?(r="function"==typeof t?t:Array.isArray(t)?N(E.call(t)):N(t),e):r},e}function D(t,n){let r;if(void 0===n)for(const n of t)null!=n&&(r<n||void 0===r&&n>=n)&&(r=n);else{let e=-1;for(let o of t)null!=(o=n(o,++e,t))&&(r<o||void 0===r&&o>=o)&&(r=o)}return r}function R(t,n){let r;if(void 0===n)for(const n of t)null!=n&&(r>n||void 0===r&&n>=n)&&(r=n);else{let e=-1;for(let o of t)null!=(o=n(o,++e,t))&&(r>o||void 0===r&&o>=o)&&(r=o)}return r}function U(t,r,e=0,o=t.length-1,f=n){for(;o>e;){if(o-e>600){const n=o-e+1,i=r-e+1,u=Math.log(n),l=.5*Math.exp(2*u/3),s=.5*Math.sqrt(u*l*(n-l)/n)*(i-n/2<0?-1:1);U(t,r,Math.max(e,Math.floor(r-i*l/n+s)),Math.min(o,Math.floor(r+(n-i)*l/n+s)),f)}const n=t[r];let i=e,u=o;for(B(t,e,r),f(t[o],n)>0&&B(t,e,o);i<u;){for(B(t,i,u),++i,--u;f(t[i],n)<0;)++i;for(;f(t[u],n)>0;)--u}0===f(t[e],n)?B(t,e,u):(++u,B(t,u,o)),u<=r&&(e=u+1),r<=u&&(o=u-1)}return t}function B(t,n,r){const e=t[n];t[n]=t[r],t[r]=e}function G(t,n,r){if(e=(t=Float64Array.from(function*(t,n){if(void 0===n)for(let n of t)null!=n&&(n=+n)>=n&&(yield n);else{let r=-1;for(let e of t)null!=(e=n(e,++r,t))&&(e=+e)>=e&&(yield e)}}(t,r))).length){if((n=+n)<=0||e<2)return R(t);if(n>=1)return D(t);var e,o=(e-1)*n,f=Math.floor(o),i=D(U(t,f).subarray(0,f+1));return i+(R(t.subarray(f+1))-i)*(o-f)}}function H(t,n){let r,e=-1,o=-1;if(void 0===n)for(const n of t)++o,null!=n&&(r<n||void 0===r&&n>=n)&&(r=n,e=o);else for(let f of t)null!=(f=n(f,++o,t))&&(r<f||void 0===r&&f>=f)&&(r=f,e=o);return e}function J(t,n){let r,e=-1,o=-1;if(void 0===n)for(const n of t)++o,null!=n&&(r>n||void 0===r&&n>=n)&&(r=n,e=o);else for(let f of t)null!=(f=n(f,++o,t))&&(r>f||void 0===r&&f>=f)&&(r=f,e=o);return e}function K(t,n){return[t,n]}function Q(t,r=n){if(1===r.length)return J(t,r);let e,o=-1,f=-1;for(const n of t)++f,(o<0?0===r(n,n):r(n,e)<0)&&(e=n,o=f);return o}var V=W(Math.random);function W(t){return function(n,r=0,e=n.length){let o=e-(r=+r);for(;o;){const e=t()*o--|0,f=n[o+r];n[o+r]=n[e+r],n[e+r]=f}return n}}function X(t){if(!(o=t.length))return[];for(var n=-1,r=R(t,Y),e=new Array(r);++n<r;)for(var o,f=-1,i=e[n]=new Array(o);++f<o;)i[f]=t[f][n];return e}function Y(t){return t.length}function Z(t){return t instanceof Set?t:new Set(t)}function $(t,n){const r=t[Symbol.iterator](),e=new Set;for(const t of n){if(e.has(t))continue;let n,o;for(;({value:n,done:o}=r.next());){if(o)return!1;if(e.add(n),Object.is(t,n))break}}return!0}t.Adder=y,t.InternMap=v,t.InternSet=m,t.ascending=n,t.bin=C,t.bisect=f,t.bisectCenter=u,t.bisectLeft=i,t.bisectRight=f,t.bisector=r,t.count=l,t.cross=function(...t){const n="function"==typeof t[t.length-1]&&function(t){return n=>t(...n)}(t.pop()),r=(t=t.map(a)).map(s),e=t.length-1,o=new Array(e+1).fill(0),f=[];if(e<0||r.some(c))return f;for(;;){f.push(o.map(((n,r)=>t[r][n])));let i=e;for(;++o[i]===r[i];){if(0===i)return n?f.map(n):f;o[i--]=0}}},t.cumsum=function(t,n){var r=0,e=0;return Float64Array.from(t,void 0===n?t=>r+=+t||0:o=>r+=+n(o,e++,t)||0)},t.descending=function(t,n){return n<t?-1:n>t?1:n>=t?0:NaN},t.deviation=d,t.difference=function(t,...n){t=new Set(t);for(const r of n)for(const n of r)t.delete(n);return t},t.disjoint=function(t,n){const r=n[Symbol.iterator](),e=new Set;for(const n of t){if(e.has(n))return!1;let t,o;for(;({value:t,done:o}=r.next())&&!o;){if(Object.is(n,t))return!1;e.add(t)}}return!0},t.every=function(t,n){if("function"!=typeof n)throw new TypeError("test is not a function");let r=-1;for(const e of t)if(!n(e,++r,t))return!1;return!0},t.extent=p,t.fcumsum=function(t,n){const r=new y;let e=-1;return Float64Array.from(t,void 0===n?t=>r.add(+t||0):o=>r.add(+n(o,++e,t)||0))},t.filter=function(t,n){if("function"!=typeof n)throw new TypeError("test is not a function");const r=[];let e=-1;for(const o of t)n(o,++e,t)&&r.push(o);return r},t.fsum=function(t,n){const r=new y;if(void 0===n)for(let n of t)(n=+n)&&r.add(n);else{let e=-1;for(let o of t)(o=+n(o,++e,t))&&r.add(o)}return+r},t.greatest=function(t,r=n){let e,o=!1;if(1===r.length){let f;for(const i of t){const t=r(i);(o?n(t,f)>0:0===n(t,t))&&(e=i,f=t,o=!0)}}else for(const n of t)(o?r(n,e)>0:0===r(n,n))&&(e=n,o=!0);return e},t.greatestIndex=function(t,r=n){if(1===r.length)return H(t,r);let e,o=-1,f=-1;for(const n of t)++f,(o<0?0===r(n,n):r(n,e)>0)&&(e=n,o=f);return o},t.group=x,t.groupSort=function(t,r,e){return(1===r.length?j(S(t,r,e),(([t,r],[e,o])=>n(r,o)||n(t,e))):j(x(t,e),(([t,e],[o,f])=>r(e,f)||n(t,o)))).map((([t])=>t))},t.groups=function(t,...n){return k(t,Array.from,A,n)},t.histogram=C,t.index=function(t,...n){return k(t,A,_,n)},t.indexes=function(t,...n){return k(t,Array.from,_,n)},t.intersection=function(t,...n){t=new Set(t),n=n.map(Z);t:for(const r of t)for(const e of n)if(!e.has(r)){t.delete(r);continue t}return t},t.least=function(t,r=n){let e,o=!1;if(1===r.length){let f;for(const i of t){const t=r(i);(o?n(t,f)<0:0===n(t,t))&&(e=i,f=t,o=!0)}}else for(const n of t)(o?r(n,e)<0:0===r(n,n))&&(e=n,o=!0);return e},t.leastIndex=Q,t.map=function(t,n){if("function"!=typeof t[Symbol.iterator])throw new TypeError("values is not iterable");if("function"!=typeof n)throw new TypeError("mapper is not a function");return Array.from(t,((r,e)=>n(r,e,t)))},t.max=D,t.maxIndex=H,t.mean=function(t,n){let r=0,e=0;if(void 0===n)for(let n of t)null!=n&&(n=+n)>=n&&(++r,e+=n);else{let o=-1;for(let f of t)null!=(f=n(f,++o,t))&&(f=+f)>=f&&(++r,e+=f)}if(r)return e/r},t.median=function(t,n){return G(t,.5,n)},t.merge=function(t){return Array.from(function*(t){for(const n of t)yield*n}(t))},t.min=R,t.minIndex=J,t.nice=P,t.pairs=function(t,n=K){const r=[];let e,o=!1;for(const f of t)o&&r.push(n(e,f)),e=f,o=!0;return r},t.permute=T,t.quantile=G,t.quantileSorted=function(t,n,r=e){if(o=t.length){if((n=+n)<=0||o<2)return+r(t[0],0,t);if(n>=1)return+r(t[o-1],o-1,t);var o,f=(o-1)*n,i=Math.floor(f),u=+r(t[i],i,t);return u+(+r(t[i+1],i+1,t)-u)*(f-i)}},t.quickselect=U,t.range=function(t,n,r){t=+t,n=+n,r=(o=arguments.length)<2?(n=t,t=0,1):o<3?1:+r;for(var e=-1,o=0|Math.max(0,Math.ceil((n-t)/r)),f=new Array(o);++e<o;)f[e]=t+e*r;return f},t.reduce=function(t,n,r){if("function"!=typeof n)throw new TypeError("reducer is not a function");const e=t[Symbol.iterator]();let o,f,i=-1;if(arguments.length<3){if(({done:o,value:r}=e.next()),o)return;++i}for(;({done:o,value:f}=e.next()),!o;)r=n(r,f,++i,t);return r},t.reverse=function(t){if("function"!=typeof t[Symbol.iterator])throw new TypeError("values is not iterable");return Array.from(t).reverse()},t.rollup=S,t.rollups=function(t,n,...r){return k(t,Array.from,n,r)},t.scan=function(t,n){const r=Q(t,n);return r<0?void 0:r},t.shuffle=V,t.shuffler=W,t.some=function(t,n){if("function"!=typeof n)throw new TypeError("test is not a function");let r=-1;for(const e of t)if(n(e,++r,t))return!0;return!1},t.sort=j,t.subset=function(t,n){return $(n,t)},t.sum=function(t,n){let r=0;if(void 0===n)for(let n of t)(n=+n)&&(r+=n);else{let e=-1;for(let o of t)(o=+n(o,++e,t))&&(r+=o)}return r},t.superset=$,t.thresholdFreedmanDiaconis=function(t,n,r){return Math.ceil((r-n)/(2*(G(t,.75)-G(t,.25))*Math.pow(l(t),-1/3)))},t.thresholdScott=function(t,n,r){return Math.ceil((r-n)/(3.5*d(t)*Math.pow(l(t),-1/3)))},t.thresholdSturges=z,t.tickIncrement=L,t.tickStep=function(t,n,r){var e=Math.abs(n-t)/Math.max(0,r),o=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),f=e/o;return f>=q?o*=10:f>=F?o*=5:f>=I&&(o*=2),n<t?-o:o},t.ticks=O,t.transpose=X,t.union=function(...t){const n=new Set;for(const r of t)for(const t of r)n.add(t);return n},t.variance=h,t.zip=function(){return X(arguments)},Object.defineProperty(t,"__esModule",{value:!0})}));
// https://d3js.org/d3-array/ v3.0.0 Copyright 2021 Mike Bostock
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).d3=t.d3||{})}(this,(function(t){"use strict";function n(t,n){return null==t||null==n?NaN:t<n?-1:t>n?1:t>=n?0:NaN}function r(t){let r=t,e=t;function o(t,n,r,o){for(null==r&&(r=0),null==o&&(o=t.length);r<o;){const f=r+o>>>1;e(t[f],n)<0?r=f+1:o=f}return r}return 1===t.length&&(r=(n,r)=>t(n)-r,e=function(t){return(r,e)=>n(t(r),e)}(t)),{left:o,center:function(t,n,e,f){null==e&&(e=0),null==f&&(f=t.length);const u=o(t,n,e,f-1);return u>e&&r(t[u-1],n)>-r(t[u],n)?u-1:u},right:function(t,n,r,o){for(null==r&&(r=0),null==o&&(o=t.length);r<o;){const f=r+o>>>1;e(t[f],n)>0?o=f:r=f+1}return r}}}function e(t){return null===t?NaN:+t}const o=r(n),f=o.right,u=o.left,i=r(e).center;function l(t,n){let r=0;if(void 0===n)for(let n of t)null!=n&&(n=+n)>=n&&++r;else{let e=-1;for(let o of t)null!=(o=n(o,++e,t))&&(o=+o)>=o&&++r}return r}function s(t){return 0|t.length}function c(t){return!(t>0)}function a(t){return"object"!=typeof t||"length"in t?t:Array.from(t)}function h(t,n){let r,e=0,o=0,f=0;if(void 0===n)for(let n of t)null!=n&&(n=+n)>=n&&(r=n-o,o+=r/++e,f+=r*(n-o));else{let u=-1;for(let i of t)null!=(i=n(i,++u,t))&&(i=+i)>=i&&(r=i-o,o+=r/++e,f+=r*(i-o))}if(e>1)return f/(e-1)}function d(t,n){const r=h(t,n);return r?Math.sqrt(r):r}function p(t,n){let r,e;if(void 0===n)for(const n of t)null!=n&&(void 0===r?n>=n&&(r=e=n):(r>n&&(r=n),e<n&&(e=n)));else{let o=-1;for(let f of t)null!=(f=n(f,++o,t))&&(void 0===r?f>=f&&(r=e=f):(r>f&&(r=f),e<f&&(e=f)))}return[r,e]}class y{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){const n=this._partials;let r=0;for(let e=0;e<this._n&&e<32;e++){const o=n[e],f=t+o,u=Math.abs(t)<Math.abs(o)?t-(f-o):o-(f-t);u&&(n[r++]=u),t=f}return n[r]=t,this._n=r+1,this}valueOf(){const t=this._partials;let n,r,e,o=this._n,f=0;if(o>0){for(f=t[--o];o>0&&(n=f,r=t[--o],f=n+r,e=r-(f-n),!e););o>0&&(e<0&&t[o-1]<0||e>0&&t[o-1]>0)&&(r=2*e,n=f+r,r==n-f&&(f=n))}return f}}class v extends Map{constructor(t,n=b){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),null!=t)for(const[n,r]of t)this.set(n,r)}get(t){return super.get(m(this,t))}has(t){return super.has(m(this,t))}set(t,n){return super.set(M(this,t),n)}delete(t){return super.delete(w(this,t))}}class g extends Set{constructor(t,n=b){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),null!=t)for(const n of t)this.add(n)}has(t){return super.has(m(this,t))}add(t){return super.add(M(this,t))}delete(t){return super.delete(w(this,t))}}function m({_intern:t,_key:n},r){const e=n(r);return t.has(e)?t.get(e):r}function M({_intern:t,_key:n},r){const e=n(r);return t.has(e)?t.get(e):(t.set(e,r),r)}function w({_intern:t,_key:n},r){const e=n(r);return t.has(e)&&(r=t.get(r),t.delete(e)),r}function b(t){return null!==t&&"object"==typeof t?t.valueOf():t}function A(t){return t}function x(t,...n){return j(t,A,A,n)}function S(t,...n){return j(t,Array.from,A,n)}function _(t,n){for(let r=1,e=n.length;r<e;++r)t=t.flatMap((t=>t.pop().map((([n,r])=>[...t,n,r]))));return t}function N(t,n,...r){return j(t,A,n,r)}function k(t,n,...r){return j(t,Array.from,n,r)}function T(t){if(1!==t.length)throw new Error("duplicate key");return t[0]}function j(t,n,r,e){return function t(o,f){if(f>=e.length)return r(o);const u=new v,i=e[f++];let l=-1;for(const t of o){const n=i(t,++l,o),r=u.get(n);r?r.push(t):u.set(n,[t])}for(const[n,r]of u)u.set(n,t(r,f));return n(u)}(t,0)}function E(t,n){return Array.from(n,(n=>t[n]))}function q(t,...r){if("function"!=typeof t[Symbol.iterator])throw new TypeError("values is not iterable");t=Array.from(t);let[e=n]=r;if(1===e.length||r.length>1){const o=Uint32Array.from(t,((t,n)=>n));return r.length>1?(r=r.map((n=>t.map(n))),o.sort(((t,e)=>{for(const o of r){const r=n(o[t],o[e]);if(r)return r}}))):(e=t.map(e),o.sort(((t,r)=>n(e[t],e[r])))),E(t,o)}return t.sort(e)}var F=Array.prototype.slice;function I(t){return function(){return t}}var O=Math.sqrt(50),L=Math.sqrt(10),P=Math.sqrt(2);function R(t,n,r){var e,o,f,u,i=-1;if(r=+r,(t=+t)===(n=+n)&&r>0)return[t];if((e=n<t)&&(o=t,t=n,n=o),0===(u=z(t,n,r))||!isFinite(u))return[];if(u>0){let r=Math.round(t/u),e=Math.round(n/u);for(r*u<t&&++r,e*u>n&&--e,f=new Array(o=e-r+1);++i<o;)f[i]=(r+i)*u}else{u=-u;let r=Math.round(t*u),e=Math.round(n*u);for(r/u<t&&++r,e/u>n&&--e,f=new Array(o=e-r+1);++i<o;)f[i]=(r+i)/u}return e&&f.reverse(),f}function z(t,n,r){var e=(n-t)/Math.max(0,r),o=Math.floor(Math.log(e)/Math.LN10),f=e/Math.pow(10,o);return o>=0?(f>=O?10:f>=L?5:f>=P?2:1)*Math.pow(10,o):-Math.pow(10,-o)/(f>=O?10:f>=L?5:f>=P?2:1)}function C(t,n,r){let e;for(;;){const o=z(t,n,r);if(o===e||0===o||!isFinite(o))return[t,n];o>0?(t=Math.floor(t/o)*o,n=Math.ceil(n/o)*o):o<0&&(t=Math.ceil(t*o)/o,n=Math.floor(n*o)/o),e=o}}function D(t){return Math.ceil(Math.log(l(t))/Math.LN2)+1}function G(){var t=A,n=p,r=D;function e(e){Array.isArray(e)||(e=Array.from(e));var o,u,i=e.length,l=new Array(i);for(o=0;o<i;++o)l[o]=t(e[o],o,e);var s=n(l),c=s[0],a=s[1],h=r(l,c,a);if(!Array.isArray(h)){const t=a,r=+h;if(n===p&&([c,a]=C(c,a,r)),(h=R(c,a,r))[h.length-1]>=a)if(t>=a&&n===p){const t=z(c,a,r);isFinite(t)&&(t>0?a=(Math.floor(a/t)+1)*t:t<0&&(a=(Math.ceil(a*-t)+1)/-t))}else h.pop()}for(var d=h.length;h[0]<=c;)h.shift(),--d;for(;h[d-1]>a;)h.pop(),--d;var y,v=new Array(d+1);for(o=0;o<=d;++o)(y=v[o]=[]).x0=o>0?h[o-1]:c,y.x1=o<d?h[o]:a;for(o=0;o<i;++o)null!=(u=l[o])&&c<=u&&u<=a&&v[f(h,u,0,d)].push(e[o]);return v}return e.value=function(n){return arguments.length?(t="function"==typeof n?n:I(n),e):t},e.domain=function(t){return arguments.length?(n="function"==typeof t?t:I([t[0],t[1]]),e):n},e.thresholds=function(t){return arguments.length?(r="function"==typeof t?t:Array.isArray(t)?I(F.call(t)):I(t),e):r},e}function U(t,n){let r;if(void 0===n)for(const n of t)null!=n&&(r<n||void 0===r&&n>=n)&&(r=n);else{let e=-1;for(let o of t)null!=(o=n(o,++e,t))&&(r<o||void 0===r&&o>=o)&&(r=o)}return r}function B(t,n){let r;if(void 0===n)for(const n of t)null!=n&&(r>n||void 0===r&&n>=n)&&(r=n);else{let e=-1;for(let o of t)null!=(o=n(o,++e,t))&&(r>o||void 0===r&&o>=o)&&(r=o)}return r}function H(t,r,e=0,o=t.length-1,f=n){for(;o>e;){if(o-e>600){const n=o-e+1,u=r-e+1,i=Math.log(n),l=.5*Math.exp(2*i/3),s=.5*Math.sqrt(i*l*(n-l)/n)*(u-n/2<0?-1:1);H(t,r,Math.max(e,Math.floor(r-u*l/n+s)),Math.min(o,Math.floor(r+(n-u)*l/n+s)),f)}const n=t[r];let u=e,i=o;for(J(t,e,r),f(t[o],n)>0&&J(t,e,o);u<i;){for(J(t,u,i),++u,--i;f(t[u],n)<0;)++u;for(;f(t[i],n)>0;)--i}0===f(t[e],n)?J(t,e,i):(++i,J(t,i,o)),i<=r&&(e=i+1),r<=i&&(o=i-1)}return t}function J(t,n,r){const e=t[n];t[n]=t[r],t[r]=e}function K(t,n,r){if(e=(t=Float64Array.from(function*(t,n){if(void 0===n)for(let n of t)null!=n&&(n=+n)>=n&&(yield n);else{let r=-1;for(let e of t)null!=(e=n(e,++r,t))&&(e=+e)>=e&&(yield e)}}(t,r))).length){if((n=+n)<=0||e<2)return B(t);if(n>=1)return U(t);var e,o=(e-1)*n,f=Math.floor(o),u=U(H(t,f).subarray(0,f+1));return u+(B(t.subarray(f+1))-u)*(o-f)}}function Q(t,n){let r,e=-1,o=-1;if(void 0===n)for(const n of t)++o,null!=n&&(r<n||void 0===r&&n>=n)&&(r=n,e=o);else for(let f of t)null!=(f=n(f,++o,t))&&(r<f||void 0===r&&f>=f)&&(r=f,e=o);return e}function V(t,n){let r,e=-1,o=-1;if(void 0===n)for(const n of t)++o,null!=n&&(r>n||void 0===r&&n>=n)&&(r=n,e=o);else for(let f of t)null!=(f=n(f,++o,t))&&(r>f||void 0===r&&f>=f)&&(r=f,e=o);return e}function W(t,n){return[t,n]}function X(t,r=n){if(1===r.length)return V(t,r);let e,o=-1,f=-1;for(const n of t)++f,(o<0?0===r(n,n):r(n,e)<0)&&(e=n,o=f);return o}var Y=Z(Math.random);function Z(t){return function(n,r=0,e=n.length){let o=e-(r=+r);for(;o;){const e=t()*o--|0,f=n[o+r];n[o+r]=n[e+r],n[e+r]=f}return n}}function $(t){if(!(o=t.length))return[];for(var n=-1,r=B(t,tt),e=new Array(r);++n<r;)for(var o,f=-1,u=e[n]=new Array(o);++f<o;)u[f]=t[f][n];return e}function tt(t){return t.length}function nt(t){return t instanceof Set?t:new Set(t)}function rt(t,n){const r=t[Symbol.iterator](),e=new Set;for(const t of n){if(e.has(t))continue;let n,o;for(;({value:n,done:o}=r.next());){if(o)return!1;if(e.add(n),Object.is(t,n))break}}return!0}t.Adder=y,t.InternMap=v,t.InternSet=g,t.ascending=n,t.bin=G,t.bisect=f,t.bisectCenter=i,t.bisectLeft=u,t.bisectRight=f,t.bisector=r,t.count=l,t.cross=function(...t){const n="function"==typeof t[t.length-1]&&function(t){return n=>t(...n)}(t.pop()),r=(t=t.map(a)).map(s),e=t.length-1,o=new Array(e+1).fill(0),f=[];if(e<0||r.some(c))return f;for(;;){f.push(o.map(((n,r)=>t[r][n])));let u=e;for(;++o[u]===r[u];){if(0===u)return n?f.map(n):f;o[u--]=0}}},t.cumsum=function(t,n){var r=0,e=0;return Float64Array.from(t,void 0===n?t=>r+=+t||0:o=>r+=+n(o,e++,t)||0)},t.descending=function(t,n){return null==t||null==n?NaN:n<t?-1:n>t?1:n>=t?0:NaN},t.deviation=d,t.difference=function(t,...n){t=new Set(t);for(const r of n)for(const n of r)t.delete(n);return t},t.disjoint=function(t,n){const r=n[Symbol.iterator](),e=new Set;for(const n of t){if(e.has(n))return!1;let t,o;for(;({value:t,done:o}=r.next())&&!o;){if(Object.is(n,t))return!1;e.add(t)}}return!0},t.every=function(t,n){if("function"!=typeof n)throw new TypeError("test is not a function");let r=-1;for(const e of t)if(!n(e,++r,t))return!1;return!0},t.extent=p,t.fcumsum=function(t,n){const r=new y;let e=-1;return Float64Array.from(t,void 0===n?t=>r.add(+t||0):o=>r.add(+n(o,++e,t)||0))},t.filter=function(t,n){if("function"!=typeof n)throw new TypeError("test is not a function");const r=[];let e=-1;for(const o of t)n(o,++e,t)&&r.push(o);return r},t.flatGroup=function(t,...n){return _(S(t,...n),n)},t.flatRollup=function(t,n,...r){return _(k(t,n,...r),r)},t.fsum=function(t,n){const r=new y;if(void 0===n)for(let n of t)(n=+n)&&r.add(n);else{let e=-1;for(let o of t)(o=+n(o,++e,t))&&r.add(o)}return+r},t.greatest=function(t,r=n){let e,o=!1;if(1===r.length){let f;for(const u of t){const t=r(u);(o?n(t,f)>0:0===n(t,t))&&(e=u,f=t,o=!0)}}else for(const n of t)(o?r(n,e)>0:0===r(n,n))&&(e=n,o=!0);return e},t.greatestIndex=function(t,r=n){if(1===r.length)return Q(t,r);let e,o=-1,f=-1;for(const n of t)++f,(o<0?0===r(n,n):r(n,e)>0)&&(e=n,o=f);return o},t.group=x,t.groupSort=function(t,r,e){return(1===r.length?q(N(t,r,e),(([t,r],[e,o])=>n(r,o)||n(t,e))):q(x(t,e),(([t,e],[o,f])=>r(e,f)||n(t,o)))).map((([t])=>t))},t.groups=S,t.histogram=G,t.index=function(t,...n){return j(t,A,T,n)},t.indexes=function(t,...n){return j(t,Array.from,T,n)},t.intersection=function(t,...n){t=new Set(t),n=n.map(nt);t:for(const r of t)for(const e of n)if(!e.has(r)){t.delete(r);continue t}return t},t.least=function(t,r=n){let e,o=!1;if(1===r.length){let f;for(const u of t){const t=r(u);(o?n(t,f)<0:0===n(t,t))&&(e=u,f=t,o=!0)}}else for(const n of t)(o?r(n,e)<0:0===r(n,n))&&(e=n,o=!0);return e},t.leastIndex=X,t.map=function(t,n){if("function"!=typeof t[Symbol.iterator])throw new TypeError("values is not iterable");if("function"!=typeof n)throw new TypeError("mapper is not a function");return Array.from(t,((r,e)=>n(r,e,t)))},t.max=U,t.maxIndex=Q,t.mean=function(t,n){let r=0,e=0;if(void 0===n)for(let n of t)null!=n&&(n=+n)>=n&&(++r,e+=n);else{let o=-1;for(let f of t)null!=(f=n(f,++o,t))&&(f=+f)>=f&&(++r,e+=f)}if(r)return e/r},t.median=function(t,n){return K(t,.5,n)},t.merge=function(t){return Array.from(function*(t){for(const n of t)yield*n}(t))},t.min=B,t.minIndex=V,t.mode=function(t,n){const r=new v;if(void 0===n)for(let n of t)null!=n&&n>=n&&r.set(n,(r.get(n)||0)+1);else{let e=-1;for(let o of t)null!=(o=n(o,++e,t))&&o>=o&&r.set(o,(r.get(o)||0)+1)}let e,o=0;for(const[t,n]of r)n>o&&(o=n,e=t);return e},t.nice=C,t.pairs=function(t,n=W){const r=[];let e,o=!1;for(const f of t)o&&r.push(n(e,f)),e=f,o=!0;return r},t.permute=E,t.quantile=K,t.quantileSorted=function(t,n,r=e){if(o=t.length){if((n=+n)<=0||o<2)return+r(t[0],0,t);if(n>=1)return+r(t[o-1],o-1,t);var o,f=(o-1)*n,u=Math.floor(f),i=+r(t[u],u,t);return i+(+r(t[u+1],u+1,t)-i)*(f-u)}},t.quickselect=H,t.range=function(t,n,r){t=+t,n=+n,r=(o=arguments.length)<2?(n=t,t=0,1):o<3?1:+r;for(var e=-1,o=0|Math.max(0,Math.ceil((n-t)/r)),f=new Array(o);++e<o;)f[e]=t+e*r;return f},t.reduce=function(t,n,r){if("function"!=typeof n)throw new TypeError("reducer is not a function");const e=t[Symbol.iterator]();let o,f,u=-1;if(arguments.length<3){if(({done:o,value:r}=e.next()),o)return;++u}for(;({done:o,value:f}=e.next()),!o;)r=n(r,f,++u,t);return r},t.reverse=function(t){if("function"!=typeof t[Symbol.iterator])throw new TypeError("values is not iterable");return Array.from(t).reverse()},t.rollup=N,t.rollups=k,t.scan=function(t,n){const r=X(t,n);return r<0?void 0:r},t.shuffle=Y,t.shuffler=Z,t.some=function(t,n){if("function"!=typeof n)throw new TypeError("test is not a function");let r=-1;for(const e of t)if(n(e,++r,t))return!0;return!1},t.sort=q,t.subset=function(t,n){return rt(n,t)},t.sum=function(t,n){let r=0;if(void 0===n)for(let n of t)(n=+n)&&(r+=n);else{let e=-1;for(let o of t)(o=+n(o,++e,t))&&(r+=o)}return r},t.superset=rt,t.thresholdFreedmanDiaconis=function(t,n,r){return Math.ceil((r-n)/(2*(K(t,.75)-K(t,.25))*Math.pow(l(t),-1/3)))},t.thresholdScott=function(t,n,r){return Math.ceil((r-n)/(3.5*d(t)*Math.pow(l(t),-1/3)))},t.thresholdSturges=D,t.tickIncrement=z,t.tickStep=function(t,n,r){var e=Math.abs(n-t)/Math.max(0,r),o=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),f=e/o;return f>=O?o*=10:f>=L?o*=5:f>=P&&(o*=2),n<t?-o:o},t.ticks=R,t.transpose=$,t.union=function(...t){const n=new Set;for(const r of t)for(const t of r)n.add(t);return n},t.variance=h,t.zip=function(){return $(arguments)},Object.defineProperty(t,"__esModule",{value:!0})}));
{
"name": "d3-array",
"version": "2.12.1",
"version": "3.0.0",
"description": "Array manipulation, ordering, searching, summarizing, etc.",
"homepage": "https://d3js.org/d3-array/",
"repository": {
"type": "git",
"url": "https://github.com/d3/d3-array.git"
},
"keywords": [

@@ -16,4 +21,3 @@ "d3",

],
"homepage": "https://d3js.org/d3-array/",
"license": "BSD-3-Clause",
"license": "ISC",
"author": {

@@ -23,9 +27,3 @@ "name": "Mike Bostock",

},
"main": "dist/d3-array.js",
"unpkg": "dist/d3-array.min.js",
"module": "src/index.js",
"repository": {
"type": "git",
"url": "https://github.com/d3/d3-array.git"
},
"type": "module",
"files": [

@@ -35,22 +33,31 @@ "dist/**/*.js",

],
"scripts": {
"pretest": "rollup -c",
"test": "./test/run.sh",
"prepublishOnly": "rm -rf dist && yarn test",
"postpublish": "git push && git push --tags && cd ../d3.github.com && git pull && cp ../${npm_package_name}/dist/${npm_package_name}.js ${npm_package_name}.v${npm_package_version%%.*}.js && cp ../${npm_package_name}/dist/${npm_package_name}.min.js ${npm_package_name}.v${npm_package_version%%.*}.min.js && git add ${npm_package_name}.v${npm_package_version%%.*}.js ${npm_package_name}.v${npm_package_version%%.*}.min.js && git commit -m \"${npm_package_name} ${npm_package_version}\" && git push && cd - && zip -j dist/${npm_package_name}.zip -- LICENSE README.md dist/${npm_package_name}.js dist/${npm_package_name}.min.js"
"module": "src/index.js",
"main": "src/index.js",
"jsdelivr": "dist/d3-array.min.js",
"unpkg": "dist/d3-array.min.js",
"exports": {
"umd": "./dist/d3-array.min.js",
"default": "./src/index.js"
},
"sideEffects": false,
"dependencies": {
"internmap": "1 - 2"
},
"devDependencies": {
"@rollup/plugin-node-resolve": "11",
"d3-random": "2",
"@rollup/plugin-node-resolve": "13",
"d3-random": "2 - 3",
"eslint": "7",
"jsdom": "16",
"mocha": "8",
"rollup": "2",
"rollup-plugin-terser": "7",
"tape": "4",
"tape-await": "0.1"
"rollup-plugin-terser": "7"
},
"dependencies": {
"internmap": "^1.0.0"
"scripts": {
"test": "mocha 'test/**/*-test.js' && eslint src test",
"prepublishOnly": "rm -rf dist && yarn test && rollup -c",
"postpublish": "git push && git push --tags && cd ../d3.github.com && git pull && cp ../${npm_package_name}/dist/${npm_package_name}.js ${npm_package_name}.v${npm_package_version%%.*}.js && cp ../${npm_package_name}/dist/${npm_package_name}.min.js ${npm_package_name}.v${npm_package_version%%.*}.min.js && git add ${npm_package_name}.v${npm_package_version%%.*}.js ${npm_package_name}.v${npm_package_version%%.*}.min.js && git commit -m \"${npm_package_name} ${npm_package_version}\" && git push && cd -"
},
"engines": {
"node": ">=12"
}
}

@@ -35,9 +35,21 @@ # d3-array

If you use NPM, `npm install d3-array`. Otherwise, download the [latest release](https://github.com/d3/d3-array/releases/latest). You can also load directly from [d3js.org](https://d3js.org), either as a [standalone library](https://d3js.org/d3-array.v2.min.js) or as part of [D3](https://github.com/d3/d3). AMD, CommonJS, and vanilla environments are supported. In vanilla, a `d3` global is exported:
If you use npm, `npm install d3-array`. You can also download the [latest release on GitHub](https://github.com/d3/d3-array/releases/latest). For vanilla HTML in modern browsers, import d3-array from Skypack:
```html
<script src="https://d3js.org/d3-array.v2.min.js"></script>
<script type="module">
import {min} from "https://cdn.skypack.dev/d3-array@3";
const m = min(array);
</script>
```
For legacy environments, you can load d3-array’s UMD bundle from an npm-based CDN such as jsDelivr; a `d3` global is exported:
```html
<script src="https://cdn.jsdelivr.net/npm/d3-array@3"></script>
<script>
var min = d3.min(array);
const m = d3.min(array);

@@ -93,2 +105,6 @@ </script>

<a name="mode" href="#mode">#</a> d3.<b>mode</b>(<i>iterable</i>[, <i>accessor</i>]) · [Source](https://github.com/d3/d3-array/blob/master/src/mode.js), [Examples](https://observablehq.com/@d3/d3-mode)
Returns the mode of the given *iterable*, *i.e.* the value which appears the most often. In case of equality, returns the first of the relevant values. If the iterable contains no comparable values, returns undefined. An optional *accessor* function may be specified, which is equivalent to calling Array.from before computing the mode. This method ignores undefined, null and NaN values; this is useful for ignoring missing data.
<a name="sum" href="#sum">#</a> d3.<b>sum</b>(<i>iterable</i>[, <i>accessor</i>]) · [Source](https://github.com/d3/d3-array/blob/master/src/sum.js), [Examples](https://observablehq.com/@d3/d3-sum)

@@ -297,3 +313,3 @@

function ascending(a, b) {
return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
return a == null || b == null ? NaN : a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
}

@@ -306,7 +322,7 @@ ```

Returns -1 if *a* is greater than *b*, or 1 if *a* is less than *b*, or 0. This is the comparator function for reverse natural order, and can be used in conjunction with the built-in array sort method to arrange elements in descending order. It is implemented as:
Returns -1 if *a* is greater than *b*, or 1 if *a* is less than *b*, or 0. This is the comparator function for reverse natural order, and can be used in conjunction with the built-in array sort method to arrange elements in descending order. It is implemented as:
```js
function descending(a, b) {
return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
return a == null || b == null ? NaN : b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
}

@@ -410,2 +426,6 @@ ```

<a name="flatGroup" href="#flatGroup">#</a> d3.<b>flatGroup</b>(<i>iterable</i>, <i>...keys</i>) · [Source](https://github.com/d3/d3-array/blob/master/src/group.js), [Examples](https://observablehq.com/@d3/d3-flatgroup)
Equivalent to [group](#group), but returns a flat array of [*key0*, *key1*, …, *values*] instead of nested maps.
<a name="index" href="#index">#</a> d3.<b>index</b>(<i>iterable</i>, <i>...keys</i>) · [Source](https://github.com/d3/d3-array/blob/master/src/group.js), [Examples](https://observablehq.com/@d3/d3-group)

@@ -501,2 +521,6 @@

<a name="flatRollup" href="#flatRollup">#</a> d3.<b>flatRollup</b>(<i>iterable</i>, <i>...keys</i>) · [Source](https://github.com/d3/d3-array/blob/master/src/group.js), [Examples](https://observablehq.com/@d3/d3-flatgroup)
Equivalent to [rollup](#rollup), but returns a flat array of [*key0*, *key1*, …, *value*] instead of nested maps.
<a name="groupSort" href="#groupSort">#</a> d3.<b>groupSort</b>(<i>iterable</i>, <i>comparator</i>, <i>key</i>) · [Source](https://github.com/d3/d3-array/blob/master/src/groupSort.js), [Examples](https://observablehq.com/@d3/d3-groupsort)

@@ -813,2 +837,4 @@ <br><a name="groupSort" href="#groupSort">#</a> d3.<b>groupSort</b>(<i>iterable</i>, <i>accessor</i>, <i>key</i>)

Any null or non-comparable values in the given *data*, or those outside the [domain](#bin_domain), are ignored.
<a name="bin_value" href="#bin_value">#</a> <i>bin</i>.<b>value</b>([<i>value</i>]) · [Source](https://github.com/d3/d3-array/blob/master/src/bin.js), [Examples](https://observablehq.com/@d3/d3-bin)

@@ -815,0 +841,0 @@

export default function(a, b) {
return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
return a == null || b == null ? NaN
: a < b ? -1
: a > b ? 1
: a >= b ? 0
: NaN;
}

@@ -80,3 +80,3 @@ import {slice} from "./array.js";

x = values[i];
if (x0 <= x && x <= x1) {
if (x != null && x0 <= x && x <= x1) {
bins[bisect(tz, x, 0, m)].push(data[i]);

@@ -83,0 +83,0 @@ }

export default function(a, b) {
return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
return a == null || b == null ? NaN
: b < a ? -1
: b > a ? 1
: b >= a ? 0
: NaN;
}

@@ -12,2 +12,17 @@ import {InternMap} from "internmap";

function flatten(groups, keys) {
for (let i = 1, n = keys.length; i < n; ++i) {
groups = groups.flatMap(g => g.pop().map(([key, value]) => [...g, key, value]));
}
return groups;
}
export function flatGroup(values, ...keys) {
return flatten(groups(values, ...keys), keys);
}
export function flatRollup(values, reduce, ...keys) {
return flatten(rollups(values, reduce, ...keys), keys);
}
export function rollup(values, reduce, ...keys) {

@@ -14,0 +29,0 @@ return nest(values, identity, reduce, keys);

@@ -11,3 +11,3 @@ export {default as bisect, bisectRight, bisectLeft, bisectCenter} from "./bisect.js";

export {Adder, fsum, fcumsum} from "./fsum.js";
export {default as group, groups, index, indexes, rollup, rollups} from "./group.js";
export {default as group, flatGroup, flatRollup, groups, index, indexes, rollup, rollups} from "./group.js";
export {default as groupSort} from "./groupSort.js";

@@ -25,2 +25,3 @@ export {default as bin, default as histogram} from "./bin.js"; // Deprecated; use bin.

export {default as minIndex} from "./minIndex.js";
export {default as mode} from "./mode.js";
export {default as nice} from "./nice.js";

@@ -27,0 +28,0 @@ export {default as pairs} from "./pairs.js";

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc