Socket
Socket
Sign inDemoInstall

d3-array

Package Overview
Dependencies
Maintainers
1
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

d3-array - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

8

build/d3-array.js

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

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

@@ -7,0 +7,0 @@

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

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

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

"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 && cd ../d3.github.com && git pull && cp ../d3-array/build/d3-array.js d3-array.v1.js && cp ../d3-array/build/d3-array.min.js d3-array.v1.min.js && git add d3-array.v1.js d3-array.v1.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"
"postpublish": "git push && git push --tags && cd ../d3.github.com && git pull && cp ../d3-array/build/d3-array.js d3-array.v1.js && cp ../d3-array/build/d3-array.min.js d3-array.v1.min.js && git add d3-array.v1.js d3-array.v1.min.js && git commit -m \"d3-array ${npm_package_version}\" && git push && cd - && zip -j build/d3-array.zip -- LICENSE README.md build/d3-array.js build/d3-array.min.js"
},

@@ -39,3 +39,3 @@ "devDependencies": {

"package-preamble": "0.0",
"rollup": "0.36",
"rollup": "0.41",
"seedrandom": "2",

@@ -42,0 +42,0 @@ "tape": "4",

@@ -62,5 +62,5 @@ # d3-array

Returns the minimum value in the given *array* using natural order. If the array is empty, returns undefined. An optional *accessor* function may be specified, which is equivalent to calling *array.map(accessor)* before computing the minimum value.
Returns the minimum value in the given *array* using natural order. If the array is empty, returns undefined. An optional *accessor* function may be specified, which is equivalent to calling *array*.map(*accessor*) before computing the minimum value.
Unlike the built-in [Math.min](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Math/min), this method ignores undefined, null and NaN values; this is useful for ignoring missing data. In addition, elements are compared using *natural* order rather than *numeric* order. For example, the minimum of ["20", "3"] is "20", while the minimum of [20, 3] is 3.
Unlike the built-in [Math.min](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Math/min), this method ignores undefined, null and NaN values; this is useful for ignoring missing data. In addition, elements are compared using natural order rather than numeric order. For example, the minimum of the strings [“20”, “3”] is “20”, while the minimum of the numbers [20, 3] is 3.

@@ -71,5 +71,5 @@ See also [scan](#scan) and [extent](#extent).

Returns the maximum value in the given *array* using natural order. If the array is empty, returns undefined. An optional *accessor* function may be specified, which is equivalent to calling *array.map(accessor)* before computing the maximum value.
Returns the maximum value in the given *array* using natural order. If the array is empty, returns undefined. An optional *accessor* function may be specified, which is equivalent to calling *array*.map(*accessor*) before computing the maximum value.
Unlike the built-in [Math.max](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Math/max), this method ignores undefined values; this is useful for ignoring missing data. In addition, elements are compared using *natural* order rather than *numeric* order. For example, the maximum of ["20", "3"] is "3", while the maximum of [20, 3] is 20.
Unlike the built-in [Math.max](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Math/max), this method ignores undefined values; this is useful for ignoring missing data. In addition, elements are compared using natural order rather than numeric order. For example, the maximum of the strings [“20”, “3”] is “3”, while the maximum of the numbers [20, 3] is 20.

@@ -80,19 +80,19 @@ See also [scan](#scan) and [extent](#extent).

Returns the [minimum](#min) and [maximum](#max) value in the given *array* using natural order. If the array is empty, returns [undefined, undefined]. An optional *accessor* function may be specified, which is equivalent to calling *array.map(accessor)* before computing the extent.
Returns the [minimum](#min) and [maximum](#max) value in the given *array* using natural order. If the array is empty, returns [undefined, undefined]. An optional *accessor* function may be specified, which is equivalent to calling *array*.map(*accessor*) before computing the extent.
<a name="sum" href="#sum">#</a> d3.<b>sum</b>(<i>array</i>[, <i>accessor</i>]) [<>](https://github.com/d3/d3-array/blob/master/src/sum.js "Source")
Returns the sum of the given *array* of numbers. If the array is empty, returns 0. An optional *accessor* function may be specified, which is equivalent to calling *array.map(accessor)* before computing the sum. This method ignores undefined and NaN values; this is useful for ignoring missing data.
Returns the sum of the given *array* of numbers. If the array is empty, returns 0. An optional *accessor* function may be specified, which is equivalent to calling *array*.map(*accessor*) before computing the sum. This method ignores undefined and NaN values; this is useful for ignoring missing data.
<a name="mean" href="#mean">#</a> d3.<b>mean</b>(<i>array</i>[, <i>accessor</i>]) [<>](https://github.com/d3/d3-array/blob/master/src/mean.js "Source")
Returns the mean of the given *array* of numbers. If the array is empty, returns undefined. An optional *accessor* function may be specified, which is equivalent to calling *array.map(accessor)* before computing the mean. This method ignores undefined and NaN values; this is useful for ignoring missing data.
Returns the mean of the given *array* of numbers. If the array is empty, returns undefined. An optional *accessor* function may be specified, which is equivalent to calling *array*.map(*accessor*) before computing the mean. This method ignores undefined and NaN values; this is useful for ignoring missing data.
<a name="median" href="#median">#</a> d3.<b>median</b>(<i>array</i>[, <i>accessor</i>]) [<>](https://github.com/d3/d3-array/blob/master/src/median.js "Source")
Returns the median of the given *array* of numbers using the [R-7 method](https://en.wikipedia.org/wiki/Quantile#Estimating_quantiles_from_a_sample). If the array is empty, returns undefined. An optional *accessor* function may be specified, which is equivalent to calling *array.map(accessor)* before computing the median. This method ignores undefined and NaN values; this is useful for ignoring missing data.
Returns the median of the given *array* of numbers using the [R-7 method](https://en.wikipedia.org/wiki/Quantile#Estimating_quantiles_from_a_sample). If the array is empty, returns undefined. An optional *accessor* function may be specified, which is equivalent to calling *array*.map(*accessor*) before computing the median. This method ignores undefined and NaN values; this is useful for ignoring missing data.
<a name="quantile" href="#quantile">#</a> d3.<b>quantile</b>(<i>array</i>, <i>p</i>[, <i>accessor</i>]) [<>](https://github.com/d3/d3-array/blob/master/src/quantile.js "Source")
Returns the *p*-quantile of the given sorted *array* of numbers, where *p* is a number in the range [0, 1]. For example, the median can be computed using *p* = 0.5, the first quartile at *p* = 0.25, and the third quartile at *p* = 0.75. This particular implementation uses the [R-7 method](http://en.wikipedia.org/wiki/Quantile#Quantiles_of_a_population), which is the default for the R programming language and Excel. For example:
Returns the *p*-quantile of the given **sorted** *array* of numbers, where *p* is a number in the range [0, 1]. For example, the median can be computed using *p* = 0.5, the first quartile at *p* = 0.25, and the third quartile at *p* = 0.75. This particular implementation uses the [R-7 method](http://en.wikipedia.org/wiki/Quantile#Quantiles_of_a_population), which is the default for the R programming language and Excel. For example:

@@ -109,11 +109,11 @@ ```js

An optional *accessor* function may be specified, which is equivalent to calling *array.map(accessor)* before computing the quantile.
An optional *accessor* function may be specified, which is equivalent to calling *array*.map(*accessor*) before computing the quantile.
<a name="variance" href="#variance">#</a> d3.<b>variance</b>(<i>array</i>[, <i>accessor</i>]) [<>](https://github.com/d3/d3-array/blob/master/src/variance.js "Source")
Returns an [unbiased estimator of the population variance](http://mathworld.wolfram.com/SampleVariance.html) of the given *array* of numbers. If the array has fewer than two values, returns undefined. An optional *accessor* function may be specified, which is equivalent to calling *array.map(accessor)* before computing the variance. This method ignores undefined and NaN values; this is useful for ignoring missing data.
Returns an [unbiased estimator of the population variance](http://mathworld.wolfram.com/SampleVariance.html) of the given *array* of numbers. If the array has fewer than two values, returns undefined. An optional *accessor* function may be specified, which is equivalent to calling *array*.map(*accessor*) before computing the variance. This method ignores undefined and NaN values; this is useful for ignoring missing data.
<a name="deviation" href="#deviation">#</a> d3.<b>deviation</b>(<i>array</i>[, <i>accessor</i>]) [<>](https://github.com/d3/d3-array/blob/master/src/deviation.js "Source")
Returns the standard deviation, defined as the square root of the [bias-corrected variance](#variance), of the given *array* of numbers. If the array has fewer than two values, returns undefined. An optional *accessor* function may be specified, which is equivalent to calling *array.map(accessor)* before computing the standard deviation. This method ignores undefined and NaN values; this is useful for ignoring missing data.
Returns the standard deviation, defined as the square root of the [bias-corrected variance](#variance), of the given *array* of numbers. If the array has fewer than two values, returns undefined. An optional *accessor* function may be specified, which is equivalent to calling *array*.map(*accessor*) before computing the standard deviation. This method ignores undefined and NaN values; this is useful for ignoring missing data.

@@ -171,3 +171,3 @@ ### Search

And then applied as `bisectDate(data, new Date(2011, 1, 2))`, returning an index. Note that the comparator is always passed the search value *x* as the second argument. Use a comparator rather than an accessor if you want values to be sorted in an order different than natural order, such as in descending rather than ascending order.
And then applied as *bisectDate*(*array*, *date*), returning an index. Note that the comparator is always passed the search value *x* as the second argument. Use a comparator rather than an accessor if you want values to be sorted in an order different than natural order, such as in descending rather than ascending order.

@@ -174,0 +174,0 @@ <a name="bisector_left" href="#bisector_left">#</a> <i>bisector</i>.<b>left</b>(<i>array</i>, <i>x</i>[, <i>lo</i>[, <i>hi</i>]]) [<>](https://github.com/d3/d3-array/blob/master/src/bisector.js#L6 "Source")

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