Socket
Socket
Sign inDemoInstall

d3-array

Package Overview
Dependencies
0
Maintainers
1
Versions
61
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.7.1 to 0.8.0

28

build/d3-array.js

@@ -0,5 +1,6 @@

// https://d3js.org/d3-array/ Version 0.8.0. Copyright 2016 Mike Bostock.
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(factory((global.d3_array = {})));
(factory((global.d3 = global.d3 || {})));
}(this, function (exports) { 'use strict';

@@ -51,3 +52,3 @@

function number$1(x) {
function number(x) {
return x === null ? NaN : +x;

@@ -67,3 +68,3 @@ }

while (++i < n) {
if (!isNaN(a = number$1(array[i]))) {
if (!isNaN(a = number(array[i]))) {
d = a - m;

@@ -78,3 +79,3 @@ m += d / ++j;

while (++i < n) {
if (!isNaN(a = number$1(f(array[i], i, array)))) {
if (!isNaN(a = number(f(array[i], i, array)))) {
d = a - m;

@@ -171,3 +172,3 @@ m += d / ++j;

function number(x) {
function number$1(x) {
return +x;

@@ -238,3 +239,3 @@ }

threshold = typeof _ === "function" ? _
: Array.isArray(_) ? constant(Array.prototype.map.call(_, number))
: Array.isArray(_) ? constant(Array.prototype.map.call(_, number$1))
: constant(+_);

@@ -248,3 +249,3 @@ return histogram;

function quantile(array, p, f) {
if (f == null) f = number$1;
if (f == null) f = number;
if (!(n = array.length)) return;

@@ -297,7 +298,7 @@ if ((p = +p) <= 0 || n < 2) return +f(array[0], 0, array);

if (f == null) {
while (++i < n) if (!isNaN(a = number$1(array[i]))) s += a; else --j;
while (++i < n) if (!isNaN(a = number(array[i]))) s += a; else --j;
}
else {
while (++i < n) if (!isNaN(a = number$1(f(array[i], i, array)))) s += a; else --j;
while (++i < n) if (!isNaN(a = number(f(array[i], i, array)))) s += a; else --j;
}

@@ -315,7 +316,7 @@

if (f == null) {
while (++i < n) if (!isNaN(a = number$1(array[i]))) numbers.push(a);
while (++i < n) if (!isNaN(a = number(array[i]))) numbers.push(a);
}
else {
while (++i < n) if (!isNaN(a = number$1(f(array[i], i, array)))) numbers.push(a);
while (++i < n) if (!isNaN(a = number(f(array[i], i, array)))) numbers.push(a);
}

@@ -444,5 +445,2 @@

var version = "0.7.1";
exports.version = version;
exports.bisect = bisectRight;

@@ -478,2 +476,4 @@ exports.bisectRight = bisectRight;

Object.defineProperty(exports, '__esModule', { value: true });
}));

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

!function(n,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r(n.d3_array={})}(this,function(n){"use strict";function r(n,r){return r>n?-1:n>r?1:n>=r?0:NaN}function t(n){return 1===n.length&&(n=e(n)),{left:function(r,t,e,u){for(null==e&&(e=0),null==u&&(u=r.length);u>e;){var o=e+u>>>1;n(r[o],t)<0?e=o+1:u=o}return e},right:function(r,t,e,u){for(null==e&&(e=0),null==u&&(u=r.length);u>e;){var o=e+u>>>1;n(r[o],t)>0?u=o:e=o+1}return e}}}function e(n){return function(t,e){return r(n(t),e)}}function u(n,r){return n>r?-1:r>n?1:r>=n?0:NaN}function o(n){return null===n?NaN:+n}function f(n,r){var t,e,u=n.length,f=0,l=0,i=-1,a=0;if(null==r)for(;++i<u;)isNaN(t=o(n[i]))||(e=t-f,f+=e/++a,l+=e*(t-f));else for(;++i<u;)isNaN(t=o(r(n[i],i,n)))||(e=t-f,f+=e/++a,l+=e*(t-f));return a>1?l/(a-1):void 0}function l(n,r){var t=f(n,r);return t?Math.sqrt(t):t}function i(n,r){var t,e,u,o=-1,f=n.length;if(null==r){for(;++o<f;)if(null!=(e=n[o])&&e>=e){t=u=e;break}for(;++o<f;)null!=(e=n[o])&&(t>e&&(t=e),e>u&&(u=e))}else{for(;++o<f;)if(null!=(e=r(n[o],o,n))&&e>=e){t=u=e;break}for(;++o<f;)null!=(e=r(n[o],o,n))&&(t>e&&(t=e),e>u&&(u=e))}return[t,u]}function a(n){return function(){return n}}function h(n){return n}function c(n,r,t){n=+n,r=+r,t=(u=arguments.length)<2?(r=n,n=0,1):3>u?1:+t;for(var e=-1,u=0|Math.max(0,Math.ceil((r-n)/t)),o=new Array(u);++e<u;)o[e]=n+e*t;return o}function s(n,r,t){var e=g(n,r,t);return c(Math.ceil(n/e)*e,Math.floor(r/e)*e+e/2,e)}function g(n,r,t){var e=Math.abs(r-n)/Math.max(0,t),u=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),o=e/u;return o>=C?u*=10:o>=E?u*=5:o>=G&&(u*=2),n>r?-u:u}function v(n){return Math.ceil(Math.log(n.length)/Math.LN2)+1}function p(n){return+n}function d(){function n(n){var u,o,f=n.length,l=new Array(f);for(u=0;f>u;++u)l[u]=+r(n[u],u,n);var i=t(l),a=+i[0],h=+i[1],c=e(l,a,h);Array.isArray(c)||(c=s(a,h,+c));var g=c.length;for(u=0;g>u;++u)c[u]=+c[u];for(;c[0]<=a;)c.shift(),--g;for(;c[g-1]>=h;)c.pop(),--g;var v,p=new Array(g+1);for(u=0;g>=u;++u)v=p[u]=[],v.x0=u>0?c[u-1]:a,v.x1=g>u?c[u]:h;for(u=0;f>u;++u)o=l[u],o>=a&&h>=o&&p[_(c,o,0,g)].push(n[u]);return p}var r=h,t=i,e=v;return n.value=function(t){return arguments.length?(r="function"==typeof t?t:a(+t),n):r},n.domain=function(r){return arguments.length?(t="function"==typeof r?r:a([+r[0],+r[1]]),n):t},n.thresholds=function(r){return arguments.length?(e="function"==typeof r?r:a(Array.isArray(r)?Array.prototype.map.call(r,p):+r),n):e},n}function M(n,r,t){if(null==t&&(t=o),e=n.length){if((r=+r)<=0||2>e)return+t(n[0],0,n);if(r>=1)return+t(n[e-1],e-1,n);var e,u=(e-1)*r,f=Math.floor(u),l=+t(n[f],f,n),i=+t(n[f+1],f+1,n);return l+(i-l)*(u-f)}}function m(n,t,e){return n.sort(r),Math.ceil((e-t)/(2*(M(n,.75)-M(n,.25))*Math.pow(n.length,-1/3)))}function y(n,r,t){return Math.ceil((t-r)/(3.5*l(n)*Math.pow(n.length,-1/3)))}function N(n,r){var t,e,u=-1,o=n.length;if(null==r){for(;++u<o;)if(null!=(e=n[u])&&e>=e){t=e;break}for(;++u<o;)null!=(e=n[u])&&e>t&&(t=e)}else{for(;++u<o;)if(null!=(e=r(n[u],u,n))&&e>=e){t=e;break}for(;++u<o;)null!=(e=r(n[u],u,n))&&e>t&&(t=e)}return t}function A(n,r){var t,e=0,u=n.length,f=-1,l=u;if(null==r)for(;++f<u;)isNaN(t=o(n[f]))?--l:e+=t;else for(;++f<u;)isNaN(t=o(r(n[f],f,n)))?--l:e+=t;return l?e/l:void 0}function b(n,t){var e,u=[],f=n.length,l=-1;if(null==t)for(;++l<f;)isNaN(e=o(n[l]))||u.push(e);else for(;++l<f;)isNaN(e=o(t(n[l],l,n)))||u.push(e);return M(u.sort(r),.5)}function w(n){for(var r,t,e,u=n.length,o=-1,f=0;++o<u;)f+=n[o].length;for(t=new Array(f);--u>=0;)for(e=n[u],r=e.length;--r>=0;)t[--f]=e[r];return t}function x(n,r){var t,e,u=-1,o=n.length;if(null==r){for(;++u<o;)if(null!=(e=n[u])&&e>=e){t=e;break}for(;++u<o;)null!=(e=n[u])&&t>e&&(t=e)}else{for(;++u<o;)if(null!=(e=r(n[u],u,n))&&e>=e){t=e;break}for(;++u<o;)null!=(e=r(n[u],u,n))&&t>e&&(t=e)}return t}function k(n){for(var r=0,t=n.length-1,e=n[0],u=new Array(0>t?0:t);t>r;)u[r]=[e,e=n[++r]];return u}function q(n,r){for(var t=r.length,e=new Array(t);t--;)e[t]=n[r[t]];return e}function L(n,t){if(e=n.length){var e,u,o=0,f=0,l=n[f];for(t||(t=r);++o<e;)(t(u=n[o],l)<0||0!==t(l,l))&&(l=u,f=o);return 0===t(l,l)?f:void 0}}function S(n,r,t){for(var e,u,o=(null==t?n.length:t)-(r=null==r?0:+r);o;)u=Math.random()*o--|0,e=n[o+r],n[o+r]=n[u+r],n[u+r]=e;return n}function j(n,r){var t,e=0,u=n.length,o=-1;if(null==r)for(;++o<u;)(t=+n[o])&&(e+=t);else for(;++o<u;)(t=+r(n[o],o,n))&&(e+=t);return e}function z(n){if(!(u=n.length))return[];for(var r=-1,t=x(n,D),e=new Array(t);++r<t;)for(var u,o=-1,f=e[r]=new Array(u);++o<u;)f[o]=n[o][r];return e}function D(n){return n.length}function F(){return z(arguments)}var R=t(r),_=R.right,B=R.left,C=Math.sqrt(50),E=Math.sqrt(10),G=Math.sqrt(2),H="0.7.1";n.version=H,n.bisect=_,n.bisectRight=_,n.bisectLeft=B,n.ascending=r,n.bisector=t,n.descending=u,n.deviation=l,n.extent=i,n.histogram=d,n.thresholdFreedmanDiaconis=m,n.thresholdScott=y,n.thresholdSturges=v,n.max=N,n.mean=A,n.median=b,n.merge=w,n.min=x,n.pairs=k,n.permute=q,n.quantile=M,n.range=c,n.scan=L,n.shuffle=S,n.sum=j,n.ticks=s,n.tickStep=g,n.transpose=z,n.variance=f,n.zip=F});
// https://d3js.org/d3-array/ Version 0.8.0. Copyright 2016 Mike Bostock.
!function(n,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r(n.d3=n.d3||{})}(this,function(n){"use strict";function r(n,r){return r>n?-1:n>r?1:n>=r?0:NaN}function t(n){return 1===n.length&&(n=e(n)),{left:function(r,t,e,u){for(null==e&&(e=0),null==u&&(u=r.length);u>e;){var o=e+u>>>1;n(r[o],t)<0?e=o+1:u=o}return e},right:function(r,t,e,u){for(null==e&&(e=0),null==u&&(u=r.length);u>e;){var o=e+u>>>1;n(r[o],t)>0?u=o:e=o+1}return e}}}function e(n){return function(t,e){return r(n(t),e)}}function u(n,r){return n>r?-1:r>n?1:r>=n?0:NaN}function o(n){return null===n?NaN:+n}function f(n,r){var t,e,u=n.length,f=0,l=0,i=-1,a=0;if(null==r)for(;++i<u;)isNaN(t=o(n[i]))||(e=t-f,f+=e/++a,l+=e*(t-f));else for(;++i<u;)isNaN(t=o(r(n[i],i,n)))||(e=t-f,f+=e/++a,l+=e*(t-f));return a>1?l/(a-1):void 0}function l(n,r){var t=f(n,r);return t?Math.sqrt(t):t}function i(n,r){var t,e,u,o=-1,f=n.length;if(null==r){for(;++o<f;)if(null!=(e=n[o])&&e>=e){t=u=e;break}for(;++o<f;)null!=(e=n[o])&&(t>e&&(t=e),e>u&&(u=e))}else{for(;++o<f;)if(null!=(e=r(n[o],o,n))&&e>=e){t=u=e;break}for(;++o<f;)null!=(e=r(n[o],o,n))&&(t>e&&(t=e),e>u&&(u=e))}return[t,u]}function a(n){return function(){return n}}function h(n){return n}function c(n,r,t){n=+n,r=+r,t=(u=arguments.length)<2?(r=n,n=0,1):3>u?1:+t;for(var e=-1,u=0|Math.max(0,Math.ceil((r-n)/t)),o=new Array(u);++e<u;)o[e]=n+e*t;return o}function s(n,r,t){var e=g(n,r,t);return c(Math.ceil(n/e)*e,Math.floor(r/e)*e+e/2,e)}function g(n,r,t){var e=Math.abs(r-n)/Math.max(0,t),u=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),o=e/u;return o>=R?u*=10:o>=B?u*=5:o>=C&&(u*=2),n>r?-u:u}function v(n){return Math.ceil(Math.log(n.length)/Math.LN2)+1}function d(n){return+n}function p(){function n(n){var u,o,f=n.length,l=new Array(f);for(u=0;f>u;++u)l[u]=+r(n[u],u,n);var i=t(l),a=+i[0],h=+i[1],c=e(l,a,h);Array.isArray(c)||(c=s(a,h,+c));var g=c.length;for(u=0;g>u;++u)c[u]=+c[u];for(;c[0]<=a;)c.shift(),--g;for(;c[g-1]>=h;)c.pop(),--g;var v,d=new Array(g+1);for(u=0;g>=u;++u)v=d[u]=[],v.x0=u>0?c[u-1]:a,v.x1=g>u?c[u]:h;for(u=0;f>u;++u)o=l[u],o>=a&&h>=o&&d[O(c,o,0,g)].push(n[u]);return d}var r=h,t=i,e=v;return n.value=function(t){return arguments.length?(r="function"==typeof t?t:a(+t),n):r},n.domain=function(r){return arguments.length?(t="function"==typeof r?r:a([+r[0],+r[1]]),n):t},n.thresholds=function(r){return arguments.length?(e="function"==typeof r?r:a(Array.isArray(r)?Array.prototype.map.call(r,d):+r),n):e},n}function M(n,r,t){if(null==t&&(t=o),e=n.length){if((r=+r)<=0||2>e)return+t(n[0],0,n);if(r>=1)return+t(n[e-1],e-1,n);var e,u=(e-1)*r,f=Math.floor(u),l=+t(n[f],f,n),i=+t(n[f+1],f+1,n);return l+(i-l)*(u-f)}}function y(n,t,e){return n.sort(r),Math.ceil((e-t)/(2*(M(n,.75)-M(n,.25))*Math.pow(n.length,-1/3)))}function N(n,r,t){return Math.ceil((t-r)/(3.5*l(n)*Math.pow(n.length,-1/3)))}function m(n,r){var t,e,u=-1,o=n.length;if(null==r){for(;++u<o;)if(null!=(e=n[u])&&e>=e){t=e;break}for(;++u<o;)null!=(e=n[u])&&e>t&&(t=e)}else{for(;++u<o;)if(null!=(e=r(n[u],u,n))&&e>=e){t=e;break}for(;++u<o;)null!=(e=r(n[u],u,n))&&e>t&&(t=e)}return t}function b(n,r){var t,e=0,u=n.length,f=-1,l=u;if(null==r)for(;++f<u;)isNaN(t=o(n[f]))?--l:e+=t;else for(;++f<u;)isNaN(t=o(r(n[f],f,n)))?--l:e+=t;return l?e/l:void 0}function A(n,t){var e,u=[],f=n.length,l=-1;if(null==t)for(;++l<f;)isNaN(e=o(n[l]))||u.push(e);else for(;++l<f;)isNaN(e=o(t(n[l],l,n)))||u.push(e);return M(u.sort(r),.5)}function w(n){for(var r,t,e,u=n.length,o=-1,f=0;++o<u;)f+=n[o].length;for(t=new Array(f);--u>=0;)for(e=n[u],r=e.length;--r>=0;)t[--f]=e[r];return t}function x(n,r){var t,e,u=-1,o=n.length;if(null==r){for(;++u<o;)if(null!=(e=n[u])&&e>=e){t=e;break}for(;++u<o;)null!=(e=n[u])&&t>e&&(t=e)}else{for(;++u<o;)if(null!=(e=r(n[u],u,n))&&e>=e){t=e;break}for(;++u<o;)null!=(e=r(n[u],u,n))&&t>e&&(t=e)}return t}function k(n){for(var r=0,t=n.length-1,e=n[0],u=new Array(0>t?0:t);t>r;)u[r]=[e,e=n[++r]];return u}function q(n,r){for(var t=r.length,e=new Array(t);t--;)e[t]=n[r[t]];return e}function L(n,t){if(e=n.length){var e,u,o=0,f=0,l=n[f];for(t||(t=r);++o<e;)(t(u=n[o],l)<0||0!==t(l,l))&&(l=u,f=o);return 0===t(l,l)?f:void 0}}function S(n,r,t){for(var e,u,o=(null==t?n.length:t)-(r=null==r?0:+r);o;)u=Math.random()*o--|0,e=n[o+r],n[o+r]=n[u+r],n[u+r]=e;return n}function j(n,r){var t,e=0,u=n.length,o=-1;if(null==r)for(;++o<u;)(t=+n[o])&&(e+=t);else for(;++o<u;)(t=+r(n[o],o,n))&&(e+=t);return e}function _(n){if(!(u=n.length))return[];for(var r=-1,t=x(n,z),e=new Array(t);++r<t;)for(var u,o=-1,f=e[r]=new Array(u);++o<u;)f[o]=n[o][r];return e}function z(n){return n.length}function D(){return _(arguments)}var F=t(r),O=F.right,P=F.left,R=Math.sqrt(50),B=Math.sqrt(10),C=Math.sqrt(2);n.bisect=O,n.bisectRight=O,n.bisectLeft=P,n.ascending=r,n.bisector=t,n.descending=u,n.deviation=l,n.extent=i,n.histogram=p,n.thresholdFreedmanDiaconis=y,n.thresholdScott=N,n.thresholdSturges=v,n.max=m,n.mean=b,n.median=A,n.merge=w,n.min=x,n.pairs=k,n.permute=q,n.quantile=M,n.range=c,n.scan=L,n.shuffle=S,n.sum=j,n.ticks=s,n.tickStep=g,n.transpose=_,n.variance=f,n.zip=D,Object.defineProperty(n,"__esModule",{value:!0})});
{
"name": "d3-array",
"version": "0.7.1",
"version": "0.8.0",
"description": "Array manipulation, ordering, searching, summarizing, etc.",

@@ -15,3 +15,3 @@ "keywords": [

],
"homepage": "https://github.com/d3/d3-array",
"homepage": "https://d3js.org/d3-array/",
"license": "BSD-3-Clause",

@@ -29,10 +29,11 @@ "author": {

"scripts": {
"pretest": "mkdir -p build && node -e 'process.stdout.write(\"var version = \\\"\" + require(\"./package.json\").version + \"\\\"; export * from \\\"../index\\\"; export {version};\");' > build/bundle.js && rollup -f umd -n d3_array -o build/d3-array.js -- build/bundle.js",
"test": "faucet `find test -name '*-test.js'` && eslint index.js src",
"prepublish": "npm run test && uglifyjs build/d3-array.js -c -m -o build/d3-array.min.js && rm -f build/d3-array.zip && zip -j build/d3-array.zip -- LICENSE README.md build/d3-array.js build/d3-array.min.js",
"postpublish": "VERSION=`node -e 'console.log(require(\"./package.json\").version)'`; git push && git tag -am \"Release $VERSION.\" v${VERSION} && git push --tags && cp build/d3-array.js ../d3.github.com/d3-array.v0.7.js && cp build/d3-array.min.js ../d3.github.com/d3-array.v0.7.min.js && cd ../d3.github.com && git add d3-array.v0.7.js d3-array.v0.7.min.js && git commit -m \"d3-array ${VERSION}\" && git push"
"pretest": "rm -rf build && mkdir build && rollup --banner \"$(preamble)\" -f umd -n d3 -o build/d3-array.js -- index.js",
"test": "tape 'test/**/*-test.js' && eslint index.js src",
"prepublish": "npm run test && uglifyjs --preamble \"$(preamble)\" build/d3-array.js -c -m -o build/d3-array.min.js",
"postpublish": "VERSION=`node -e 'console.log(require(\"./package.json\").version)'`; git push && git push --tags && cp build/d3-array.js ../d3.github.com/d3-array.v0.8.js && cp build/d3-array.min.js ../d3.github.com/d3-array.v0.8.min.js && cd ../d3.github.com && git add d3-array.v0.8.js d3-array.v0.8.min.js && git commit -m \"d3-array ${VERSION}\" && git push && cd - && zip -j build/d3-array.zip -- LICENSE README.md build/d3-array.js build/d3-array.min.js"
},
"devDependencies": {
"faucet": "0.0",
"rollup": "0.25",
"eslint": "2",
"package-preamble": "0.0",
"rollup": "0.27",
"seedrandom": "2",

@@ -39,0 +40,0 @@ "tape": "4",

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

If you use NPM, `npm install d3-array`. Otherwise, download the [latest release](https://github.com/d3/d3-array/releases/latest). The released bundle supports AMD, CommonJS, and vanilla environments. Create a custom build using [Rollup](https://github.com/rollup/rollup) or your preferred bundler. You can also load directly from [d3js.org](https://d3js.org):
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.v0.8.min.js) or as part of [D3 4.0](https://github.com/d3/d3). AMD, CommonJS, and vanilla environments are supported. In vanilla, a `d3` global is exported:
```html
<script src="https://d3js.org/d3-array.v0.6.min.js"></script>
<script src="https://d3js.org/d3-array.v0.8.min.js"></script>
<script>
var min = d3.min(array);
</script>
```
In a vanilla environment, a `d3_array` global is exported. [Try d3-array in your browser.](https://tonicdev.com/npm/d3-array)
[Try d3-array in your browser.](https://tonicdev.com/npm/d3-array)

@@ -241,2 +246,4 @@ ## API Reference

Ticks are inclusive in the sense that they may include the specified *start* and *stop* values if (and only if) they are exact, nicely-rounded values consistent with the inferred [step](#tickStep). More formally, each returned tick *t* satisfies *start* ≤ *t* and *t* ≤ *stop*.
<a name="tickStep" href="#tickStep">#</a> d3.<b>tickStep</b>(<i>start</i>, <i>stop</i>, <i>count</i>)

@@ -243,0 +250,0 @@

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