Comparing version 2.1.1 to 2.1.2
@@ -1,2 +0,2 @@ | ||
// https://d3js.org/d3-scale/ v2.1.1 Copyright 2018 Mike Bostock | ||
// https://d3js.org/d3-scale/ v2.1.2 Copyright 2018 Mike Bostock | ||
(function (global, factory) { | ||
@@ -3,0 +3,0 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-collection'), require('d3-array'), require('d3-interpolate'), require('d3-format'), require('d3-time'), require('d3-time-format')) : |
@@ -1,2 +0,2 @@ | ||
// https://d3js.org/d3-scale/ v2.1.1 Copyright 2018 Mike Bostock | ||
// https://d3js.org/d3-scale/ v2.1.2 Copyright 2018 Mike Bostock | ||
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("d3-collection"),require("d3-array"),require("d3-interpolate"),require("d3-format"),require("d3-time"),require("d3-time-format")):"function"==typeof define&&define.amd?define(["exports","d3-collection","d3-array","d3-interpolate","d3-format","d3-time","d3-time-format"],t):t(n.d3=n.d3||{},n.d3,n.d3,n.d3,n.d3,n.d3,n.d3)}(this,function(n,t,e,r,i,u,o){"use strict";var a=Array.prototype,c=a.map,l=a.slice,f={name:"implicit"};function h(n){var e=t.map(),r=[],i=f;function u(t){var u=t+"",o=e.get(u);if(!o){if(i!==f)return i;e.set(u,o=r.push(t))}return n[(o-1)%n.length]}return n=null==n?[]:l.call(n),u.domain=function(n){if(!arguments.length)return r.slice();r=[],e=t.map();for(var i,o,a=-1,c=n.length;++a<c;)e.has(o=(i=n[a])+"")||e.set(o,r.push(i));return u},u.range=function(t){return arguments.length?(n=l.call(t),u):n.slice()},u.unknown=function(n){return arguments.length?(i=n,u):i},u.copy=function(){return h().domain(r).range(n).unknown(i)},u}function d(){var n,t,r=h().unknown(void 0),i=r.domain,u=r.range,o=[0,1],a=!1,c=0,l=0,f=.5;function s(){var r=i().length,h=o[1]<o[0],d=o[h-0],s=o[1-h];n=(s-d)/Math.max(1,r-c+2*l),a&&(n=Math.floor(n)),d+=(s-d-n*(r-c))*f,t=n*(1-c),a&&(d=Math.round(d),t=Math.round(t));var m=e.range(r).map(function(t){return d+n*t});return u(h?m.reverse():m)}return delete r.unknown,r.domain=function(n){return arguments.length?(i(n),s()):i()},r.range=function(n){return arguments.length?(o=[+n[0],+n[1]],s()):o.slice()},r.rangeRound=function(n){return o=[+n[0],+n[1]],a=!0,s()},r.bandwidth=function(){return t},r.step=function(){return n},r.round=function(n){return arguments.length?(a=!!n,s()):a},r.padding=function(n){return arguments.length?(c=l=Math.max(0,Math.min(1,n)),s()):c},r.paddingInner=function(n){return arguments.length?(c=Math.max(0,Math.min(1,n)),s()):c},r.paddingOuter=function(n){return arguments.length?(l=Math.max(0,Math.min(1,n)),s()):l},r.align=function(n){return arguments.length?(f=Math.max(0,Math.min(1,n)),s()):f},r.copy=function(){return d().domain(i()).range(o).round(a).paddingInner(c).paddingOuter(l).align(f)},s()}function s(n){return function(){return n}}function m(n){return+n}var g=[0,1];function p(n,t){return(t-=n=+n)?function(e){return(e-n)/t}:s(t)}function M(n,t,e,r){var i=n[0],u=n[1],o=t[0],a=t[1];return u<i?(i=e(u,i),o=r(a,o)):(i=e(i,u),o=r(o,a)),function(n){return o(i(n))}}function v(n,t,r,i){var u=Math.min(n.length,t.length)-1,o=new Array(u),a=new Array(u),c=-1;for(n[u]<n[0]&&(n=n.slice().reverse(),t=t.slice().reverse());++c<u;)o[c]=r(n[c],n[c+1]),a[c]=i(t[c],t[c+1]);return function(t){var r=e.bisect(n,t,1,u)-1;return a[r](o[r](t))}}function y(n,t){return t.domain(n.domain()).range(n.range()).interpolate(n.interpolate()).clamp(n.clamp())}function x(n,t){var e,i,u,o=g,a=g,f=r.interpolate,h=!1;function d(){return e=Math.min(o.length,a.length)>2?v:M,i=u=null,s}function s(t){return(i||(i=e(o,a,h?function(n){return function(t,e){var r=n(t=+t,e=+e);return function(n){return n<=t?0:n>=e?1:r(n)}}}(n):n,f)))(+t)}return s.invert=function(n){return(u||(u=e(a,o,p,h?function(n){return function(t,e){var r=n(t=+t,e=+e);return function(n){return n<=0?t:n>=1?e:r(n)}}}(t):t)))(+n)},s.domain=function(n){return arguments.length?(o=c.call(n,m),d()):o.slice()},s.range=function(n){return arguments.length?(a=l.call(n),d()):a.slice()},s.rangeRound=function(n){return a=l.call(n),f=r.interpolateRound,d()},s.clamp=function(n){return arguments.length?(h=!!n,d()):h},s.interpolate=function(n){return arguments.length?(f=n,d()):f},d()}function k(n){var t=n.domain;return n.ticks=function(n){var r=t();return e.ticks(r[0],r[r.length-1],null==n?10:n)},n.tickFormat=function(n,r){return function(n,t,r){var u,o=n[0],a=n[n.length-1],c=e.tickStep(o,a,null==t?10:t);switch((r=i.formatSpecifier(null==r?",f":r)).type){case"s":var l=Math.max(Math.abs(o),Math.abs(a));return null!=r.precision||isNaN(u=i.precisionPrefix(c,l))||(r.precision=u),i.formatPrefix(r,l);case"":case"e":case"g":case"p":case"r":null!=r.precision||isNaN(u=i.precisionRound(c,Math.max(Math.abs(o),Math.abs(a))))||(r.precision=u-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(u=i.precisionFixed(c))||(r.precision=u-2*("%"===r.type))}return i.format(r)}(t(),n,r)},n.nice=function(r){null==r&&(r=10);var i,u=t(),o=0,a=u.length-1,c=u[o],l=u[a];return l<c&&(i=c,c=l,l=i,i=o,o=a,a=i),(i=e.tickIncrement(c,l,r))>0?(c=Math.floor(c/i)*i,l=Math.ceil(l/i)*i,i=e.tickIncrement(c,l,r)):i<0&&(c=Math.ceil(c*i)/i,l=Math.floor(l*i)/i,i=e.tickIncrement(c,l,r)),i>0?(u[o]=Math.floor(c/i)*i,u[a]=Math.ceil(l/i)*i,t(u)):i<0&&(u[o]=Math.ceil(c*i)/i,u[a]=Math.floor(l*i)/i,t(u)),n},n}function w(n,t){var e,r=0,i=(n=n.slice()).length-1,u=n[r],o=n[i];return o<u&&(e=r,r=i,i=e,e=u,u=o,o=e),n[r]=t.floor(u),n[i]=t.ceil(o),n}function b(n,t){return(t=Math.log(t/n))?function(e){return Math.log(e/n)/t}:s(t)}function N(n,t){return n<0?function(e){return-Math.pow(-t,e)*Math.pow(-n,1-e)}:function(e){return Math.pow(t,e)*Math.pow(n,1-e)}}function D(n){return isFinite(n)?+("1e"+n):n<0?0:n}function I(n){return 10===n?D:n===Math.E?Math.exp:function(t){return Math.pow(n,t)}}function q(n){return n===Math.E?Math.log:10===n&&Math.log10||2===n&&Math.log2||(n=Math.log(n),function(t){return Math.log(t)/n})}function O(n){return function(t){return-n(-t)}}function S(n,t){return n<0?-Math.pow(-n,t):Math.pow(n,t)}function F(){var n=1,t=x(function(t,e){return(e=S(e,n)-(t=S(t,n)))?function(r){return(S(r,n)-t)/e}:s(e)},function(t,e){return e=S(e,n)-(t=S(t,n)),function(r){return S(t+e*r,1/n)}}),e=t.domain;return t.exponent=function(t){return arguments.length?(n=+t,e(e())):n},t.copy=function(){return y(t,F().exponent(n))},k(t)}var A=1e3,E=60*A,P=60*E,R=24*P,T=7*R,L=30*R,U=365*R;function Y(n){return new Date(n)}function j(n){return n instanceof Date?+n:+new Date(+n)}function B(n,t,i,u,o,a,l,f,h){var d=x(p,r.interpolateNumber),s=d.invert,m=d.domain,g=h(".%L"),M=h(":%S"),v=h("%I:%M"),k=h("%I %p"),b=h("%a %d"),N=h("%b %d"),D=h("%B"),I=h("%Y"),q=[[l,1,A],[l,5,5*A],[l,15,15*A],[l,30,30*A],[a,1,E],[a,5,5*E],[a,15,15*E],[a,30,30*E],[o,1,P],[o,3,3*P],[o,6,6*P],[o,12,12*P],[u,1,R],[u,2,2*R],[i,1,T],[t,1,L],[t,3,3*L],[n,1,U]];function O(e){return(l(e)<e?g:a(e)<e?M:o(e)<e?v:u(e)<e?k:t(e)<e?i(e)<e?b:N:n(e)<e?D:I)(e)}function S(t,r,i,u){if(null==t&&(t=10),"number"==typeof t){var o=Math.abs(i-r)/t,a=e.bisector(function(n){return n[2]}).right(q,o);a===q.length?(u=e.tickStep(r/U,i/U,t),t=n):a?(u=(a=q[o/q[a-1][2]<q[a][2]/o?a-1:a])[1],t=a[0]):(u=Math.max(e.tickStep(r,i,t),1),t=f)}return null==u?t:t.every(u)}return d.invert=function(n){return new Date(s(n))},d.domain=function(n){return arguments.length?m(c.call(n,j)):m().map(Y)},d.ticks=function(n,t){var e,r=m(),i=r[0],u=r[r.length-1],o=u<i;return o&&(e=i,i=u,u=e),e=(e=S(n,i,u,t))?e.range(i,u+1):[],o?e.reverse():e},d.tickFormat=function(n,t){return null==t?O:h(t)},d.nice=function(n,t){var e=m();return(n=S(n,e[0],e[e.length-1],t))?m(w(e,n)):d},d.copy=function(){return y(d,B(n,t,i,u,o,a,l,f,h))},d}n.scaleBand=d,n.scalePoint=function(){return function n(t){var e=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,delete t.paddingOuter,t.copy=function(){return n(e())},t}(d().paddingInner(1))},n.scaleIdentity=function n(){var t=[0,1];function e(n){return+n}return e.invert=e,e.domain=e.range=function(n){return arguments.length?(t=c.call(n,m),e):t.slice()},e.copy=function(){return n().domain(t)},k(e)},n.scaleLinear=function n(){var t=x(p,r.interpolateNumber);return t.copy=function(){return y(t,n())},k(t)},n.scaleLog=function n(){var t=x(b,N).domain([1,10]),r=t.domain,u=10,o=q(10),a=I(10);function c(){return o=q(u),a=I(u),r()[0]<0&&(o=O(o),a=O(a)),t}return t.base=function(n){return arguments.length?(u=+n,c()):u},t.domain=function(n){return arguments.length?(r(n),c()):r()},t.ticks=function(n){var t,i=r(),c=i[0],l=i[i.length-1];(t=l<c)&&(s=c,c=l,l=s);var f,h,d,s=o(c),m=o(l),g=null==n?10:+n,p=[];if(!(u%1)&&m-s<g){if(s=Math.round(s)-1,m=Math.round(m)+1,c>0){for(;s<m;++s)for(h=1,f=a(s);h<u;++h)if(!((d=f*h)<c)){if(d>l)break;p.push(d)}}else for(;s<m;++s)for(h=u-1,f=a(s);h>=1;--h)if(!((d=f*h)<c)){if(d>l)break;p.push(d)}}else p=e.ticks(s,m,Math.min(m-s,g)).map(a);return t?p.reverse():p},t.tickFormat=function(n,e){if(null==e&&(e=10===u?".0e":","),"function"!=typeof e&&(e=i.format(e)),n===1/0)return e;null==n&&(n=10);var r=Math.max(1,u*n/t.ticks().length);return function(n){var t=n/a(Math.round(o(n)));return t*u<u-.5&&(t*=u),t<=r?e(n):""}},t.nice=function(){return r(w(r(),{floor:function(n){return a(Math.floor(o(n)))},ceil:function(n){return a(Math.ceil(o(n)))}}))},t.copy=function(){return y(t,n().base(u))},t},n.scaleOrdinal=h,n.scaleImplicit=f,n.scalePow=F,n.scaleSqrt=function(){return F().exponent(.5)},n.scaleQuantile=function n(){var t=[],r=[],i=[];function u(){var n=0,u=Math.max(1,r.length);for(i=new Array(u-1);++n<u;)i[n-1]=e.quantile(t,n/u);return o}function o(n){if(!isNaN(n=+n))return r[e.bisect(i,n)]}return o.invertExtent=function(n){var e=r.indexOf(n);return e<0?[NaN,NaN]:[e>0?i[e-1]:t[0],e<i.length?i[e]:t[t.length-1]]},o.domain=function(n){if(!arguments.length)return t.slice();t=[];for(var r,i=0,o=n.length;i<o;++i)null==(r=n[i])||isNaN(r=+r)||t.push(r);return t.sort(e.ascending),u()},o.range=function(n){return arguments.length?(r=l.call(n),u()):r.slice()},o.quantiles=function(){return i.slice()},o.copy=function(){return n().domain(t).range(r)},o},n.scaleQuantize=function n(){var t=0,r=1,i=1,u=[.5],o=[0,1];function a(n){if(n<=n)return o[e.bisect(u,n,0,i)]}function c(){var n=-1;for(u=new Array(i);++n<i;)u[n]=((n+1)*r-(n-i)*t)/(i+1);return a}return a.domain=function(n){return arguments.length?(t=+n[0],r=+n[1],c()):[t,r]},a.range=function(n){return arguments.length?(i=(o=l.call(n)).length-1,c()):o.slice()},a.invertExtent=function(n){var e=o.indexOf(n);return e<0?[NaN,NaN]:e<1?[t,u[0]]:e>=i?[u[i-1],r]:[u[e-1],u[e]]},a.copy=function(){return n().domain([t,r]).range(o)},k(a)},n.scaleThreshold=function n(){var t=[.5],r=[0,1],i=1;function u(n){if(n<=n)return r[e.bisect(t,n,0,i)]}return u.domain=function(n){return arguments.length?(t=l.call(n),i=Math.min(t.length,r.length-1),u):t.slice()},u.range=function(n){return arguments.length?(r=l.call(n),i=Math.min(t.length,r.length-1),u):r.slice()},u.invertExtent=function(n){var e=r.indexOf(n);return[t[e-1],t[e]]},u.copy=function(){return n().domain(t).range(r)},u},n.scaleTime=function(){return B(u.timeYear,u.timeMonth,u.timeWeek,u.timeDay,u.timeHour,u.timeMinute,u.timeSecond,u.timeMillisecond,o.timeFormat).domain([new Date(2e3,0,1),new Date(2e3,0,2)])},n.scaleUtc=function(){return B(u.utcYear,u.utcMonth,u.utcWeek,u.utcDay,u.utcHour,u.utcMinute,u.utcSecond,u.utcMillisecond,o.utcFormat).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)])},n.scaleSequential=function n(t){var e=0,r=1,i=1,u=!1;function o(n){var r=(n-e)*i;return t(u?Math.max(0,Math.min(1,r)):r)}return o.domain=function(n){return arguments.length?(e=+n[0],r=+n[1],i=e===r?0:1/(r-e),o):[e,r]},o.clamp=function(n){return arguments.length?(u=!!n,o):u},o.interpolator=function(n){return arguments.length?(t=n,o):t},o.copy=function(){return n(t).domain([e,r]).clamp(u)},k(o)},n.scaleDiverging=function n(t){var e=0,r=.5,i=1,u=1,o=1,a=!1;function c(n){var e=.5+((n=+n)-r)*(n<r?u:o);return t(a?Math.max(0,Math.min(1,e)):e)}return c.domain=function(n){return arguments.length?(e=+n[0],r=+n[1],i=+n[2],u=e===r?0:.5/(r-e),o=r===i?0:.5/(i-r),c):[e,r,i]},c.clamp=function(n){return arguments.length?(a=!!n,c):a},c.interpolator=function(n){return arguments.length?(t=n,c):t},c.copy=function(){return n(t).domain([e,r,i]).clamp(a)},k(c)},Object.defineProperty(n,"__esModule",{value:!0})}); |
{ | ||
"name": "d3-scale", | ||
"version": "2.1.1", | ||
"version": "2.1.2", | ||
"description": "Encodings that map abstract data to visual representation.", | ||
@@ -17,5 +17,6 @@ "keywords": [ | ||
}, | ||
"main": "dist/d3-scale.min.js", | ||
"module": "index", | ||
"jsnext:main": "index", | ||
"main": "dist/d3-scale.js", | ||
"unpkg": "dist/d3-scale.min.js", | ||
"jsdelivr": "dist/d3-scale.min.js", | ||
"module": "src/index.js", | ||
"repository": { | ||
@@ -27,3 +28,3 @@ "type": "git", | ||
"pretest": "rollup -c", | ||
"test": "TZ=America/Los_Angeles tape 'test/**/*-test.js' && eslint index.js src", | ||
"test": "TZ=America/Los_Angeles tape 'test/**/*-test.js' && eslint src", | ||
"prepublishOnly": "rm -rf dist && yarn test", | ||
@@ -30,0 +31,0 @@ "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" |
@@ -5,4 +5,4 @@ import {terser} from "rollup-plugin-terser"; | ||
const config = { | ||
input: "index.js", | ||
external: Object.keys(meta.dependencies || {}), | ||
input: "src/index.js", | ||
external: Object.keys(meta.dependencies || {}).filter(key => /^d3-/.test(key)), | ||
output: { | ||
@@ -15,3 +15,3 @@ file: `dist/${meta.name}.js`, | ||
banner: `// ${meta.homepage} v${meta.version} Copyright ${(new Date).getFullYear()} ${meta.author.name}`, | ||
globals: Object.assign({}, ...Object.keys(meta.dependencies || {}).map(key => ({[key]: "d3"}))) | ||
globals: Object.assign({}, ...Object.keys(meta.dependencies || {}).filter(key => /^d3-/.test(key)).map(key => ({[key]: "d3"}))) | ||
}, | ||
@@ -18,0 +18,0 @@ plugins: [] |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
169786