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

recharts-scale

Package Overview
Dependencies
Maintainers
2
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

recharts-scale - npm Package Compare versions

Comparing version 0.2.2 to 0.2.3

12

CHANGELOG.md

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

## 0.2.3 (Feb 28, 2017)
### fix
- Fix calculation precision of calculateStep, add Arithmetic.modulo
## 0.2.2 (Feb 28, 2017)
### fix
- Fix calculation precision of calculateStep
## 0.2.1 (July 25, 2016)

@@ -2,0 +14,0 @@

2

es6/getNiceTickValues.js

@@ -137,3 +137,3 @@ 'use strict';

middle = _arithmetic2.default.divide(_arithmetic2.default.sum(min, max), 2);
middle = _arithmetic2.default.minus(middle, middle % step);
middle = _arithmetic2.default.minus(middle, _arithmetic2.default.modulo(middle, step));
}

@@ -140,0 +140,0 @@

@@ -112,2 +112,15 @@ 'use strict';

function modulo(a, b) {
var mod = Math.abs(b);
if (b <= 0) {
return a;
}
var sign = a >= 0 ? 1 : -1;
var cnt = Math.floor(a / mod);
return minus(a, multiply(mod, cnt));
}
/**

@@ -190,2 +203,3 @@ * 按照固定的步长获取[start, end)这个区间的数据

divide: divide,
modulo: modulo,

@@ -192,0 +206,0 @@ interpolateNumber: interpolateNumber,

@@ -137,3 +137,3 @@ 'use strict';

middle = _arithmetic2.default.divide(_arithmetic2.default.sum(min, max), 2);
middle = _arithmetic2.default.minus(middle, middle % step);
middle = _arithmetic2.default.minus(middle, _arithmetic2.default.modulo(middle, step));
}

@@ -140,0 +140,0 @@

@@ -112,2 +112,15 @@ 'use strict';

function modulo(a, b) {
var mod = Math.abs(b);
if (b <= 0) {
return a;
}
var sign = a >= 0 ? 1 : -1;
var cnt = Math.floor(a / mod);
return minus(a, multiply(mod, cnt));
}
/**

@@ -190,2 +203,3 @@ * 按照固定的步长获取[start, end)这个区间的数据

divide: divide,
modulo: modulo,

@@ -192,0 +206,0 @@ interpolateNumber: interpolateNumber,

{
"name": "recharts-scale",
"version": "0.2.2",
"version": "0.2.3",
"description": "Scale of Cartesian Coordinates",

@@ -5,0 +5,0 @@ "main": "lib/index",

@@ -117,3 +117,3 @@ /**

middle = Arithmetic.divide(Arithmetic.sum(min, max), 2);
middle = Arithmetic.minus(middle, middle % step);
middle = Arithmetic.minus(middle, Arithmetic.modulo(middle, step));
}

@@ -120,0 +120,0 @@

@@ -105,2 +105,12 @@ /**

function modulo(a, b) {
const mod = Math.abs(b);
if (b <= 0) { return a; }
const cnt = Math.floor(a / mod);
return minus(a, multiply(mod, cnt));
}
/**

@@ -183,2 +193,3 @@ * 按照固定的步长获取[start, end)这个区间的数据

divide,
modulo,

@@ -185,0 +196,0 @@ interpolateNumber,

@@ -360,3 +360,3 @@ (function webpackUniversalModuleDefinition(root, factory) {

middle = _arithmetic2.default.divide(_arithmetic2.default.sum(min, max), 2);
middle = _arithmetic2.default.minus(middle, middle % step);
middle = _arithmetic2.default.minus(middle, _arithmetic2.default.modulo(middle, step));
}

@@ -574,2 +574,15 @@

function modulo(a, b) {
var mod = Math.abs(b);
if (b <= 0) {
return a;
}
var sign = a >= 0 ? 1 : -1;
var cnt = Math.floor(a / mod);
return minus(a, multiply(mod, cnt));
}
/**

@@ -652,2 +665,3 @@ * 按照固定的步长获取[start, end)这个区间的数据

divide: divide,
modulo: modulo,

@@ -654,0 +668,0 @@ interpolateNumber: interpolateNumber,

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

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.RechartsScale=e():t.RechartsScale=e()}(this,function(){return function(t){function e(n){if(r[n])return r[n].exports;var u=r[n]={exports:{},id:n,loaded:!1};return t[n].call(u.exports,u,u.exports,e),u.loaded=!0,u.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(2);Object.defineProperty(e,"getTickValues",{enumerable:!0,get:function(){return n.getTickValues}}),Object.defineProperty(e,"getNiceTickValues",{enumerable:!0,get:function(){return n.getNiceTickValues}})},function(t,e){"use strict";function r(t){if(Array.isArray(t)){for(var e=0,r=Array(t.length);e<t.length;e++)r[e]=t[e];return r}return Array.from(t)}Object.defineProperty(e,"__esModule",{value:!0});var n=function(t){return t},u=e.PLACE_HOLDER={"@@functional/placeholder":!0},i=function(t){return t===u},a=function(t){return function e(){return 0===arguments.length||1===arguments.length&&i(arguments.length<=0?void 0:arguments[0])?e:t.apply(void 0,arguments)}},o=function t(e,n){return 1===e?n:a(function(){for(var o=arguments.length,l=Array(o),c=0;c<o;c++)l[c]=arguments[c];var f=l.filter(function(t){return t!==u}).length;return f>=e?n.apply(void 0,l):t(e-f,a(function(){for(var t=arguments.length,e=Array(t),u=0;u<t;u++)e[u]=arguments[u];var a=l.map(function(t){return i(t)?e.shift():t});return n.apply(void 0,r(a).concat(e))}))})},l=e.curry=function(t){return o(t.length,t)};e.range=function(t,e){for(var r=[],n=t;n<e;++n)r[n-t]=n;return r},e.map=l(function(t,e){return Array.isArray(e)?e.map(t):Object.keys(e).map(function(t){return e[t]}).map(t)}),e.compose=function(){for(var t=arguments.length,e=Array(t),r=0;r<t;r++)e[r]=arguments[r];if(!e.length)return n;var u=e.reverse(),i=u[0],a=u.slice(1);return function(){return a.reduce(function(t,e){return e(t)},i.apply(void 0,arguments))}},e.reverse=function(t){return Array.isArray(t)?t.reverse():t.split("").reverse.join("")},e.memoize=function(t){var e=null,r=null;return function(){for(var n=arguments.length,u=Array(n),i=0;i<n;i++)u[i]=arguments[i];return e&&u.every(function(t,r){return t===e[r]})?r:(e=u,r=t.apply(void 0,u))}}},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function u(t){var e=f(t,2),r=e[0],n=e[1],u=r,i=n;return r>n&&(u=n,i=r),[u,i]}function i(t,e,r){if(t<=0)return 0;var n=v.default.getDigitCount(t),u=t/Math.pow(10,n),i=1!==n?v.default.multiply(Math.ceil(u/.05)+r,.05):v.default.multiply(Math.ceil(u/.1)+r,.1),a=v.default.multiply(i,Math.pow(10,n));return e?a:Math.ceil(a)}function a(t,e,r){var n=v.default.isFloat(t),u=1,i=t;if(n&&r){var a=Math.abs(t);a<1?(u=Math.pow(10,v.default.getDigitCount(t)-1),i=v.default.multiply(Math.floor(t/u),u)):a>1&&(i=Math.floor(t))}else 0===t?i=Math.floor((e-1)/2):r||(i=Math.floor(t));var o=Math.floor((e-1)/2),l=(0,p.compose)((0,p.map)(function(t){return v.default.sum(i,v.default.multiply(t-o,u))}),p.range);return l(0,e)}function o(t,e,r,n){var u=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,a=i((e-t)/(r-1),n,u),l=void 0;t<=0&&e>=0?l=0:(l=v.default.divide(v.default.sum(t,e),2),l=v.default.minus(l,l%a));var c=Math.ceil((l-t)/a),f=Math.ceil((e-l)/a),p=c+f+1;return p>r?o(t,e,r,n,u+1):(p<r&&(f=e>0?f+(r-p):f,c=e>0?c:c+(r-p)),{step:a,tickMin:v.default.minus(l,v.default.multiply(c,a)),tickMax:v.default.sum(l,v.default.multiply(f,a))})}function l(t){var e=f(t,2),r=e[0],n=e[1],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6,l=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],c=Math.max(i,2),s=u([r,n]),d=f(s,2),h=d[0],y=d[1];if(h===y)return a(h,i,l);var m=o(h,y,c,l),g=m.step,M=m.tickMin,b=m.tickMax,x=v.default.rangeStep(M,b+.1*g,g);return r>n?(0,p.reverse)(x):x}function c(t){var e=f(t,2),r=e[0],n=e[1],o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6,l=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],c=Math.max(o,2),s=u([r,n]),v=f(s,2),d=v[0],h=v[1];if(d===h)return a(d,o,l);var y=i((h-d)/(c-1),l,0),m=(0,p.compose)((0,p.map)(function(t){return d+t*y}),p.range),g=m(0,c).filter(function(t){return t>=d&&t<=h});return r>n?(0,p.reverse)(g):g}Object.defineProperty(e,"__esModule",{value:!0}),e.getTickValues=e.getNiceTickValues=void 0;var f=function(){function t(t,e){var r=[],n=!0,u=!1,i=void 0;try{for(var a,o=t[Symbol.iterator]();!(n=(a=o.next()).done)&&(r.push(a.value),!e||r.length!==e);n=!0);}catch(t){u=!0,i=t}finally{try{!n&&o.return&&o.return()}finally{if(u)throw i}}return r}return function(e,r){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),p=r(1),s=r(3),v=n(s);e.getNiceTickValues=(0,p.memoize)(l),e.getTickValues=(0,p.memoize)(c)},function(t,e,r){"use strict";function n(t){return/^([+-]?)\d*\.\d+$/.test(t)}function u(t){var e=Math.abs(t),r=void 0;if(0===t)r=1;else if(e<1)r=Math.floor(Math.log(e)/Math.log(10))+1;else{var n=""+t,u=n.split(".");r=u[0].length}return r}function i(t){var e=t?""+t:"",r=e.split(".");return r.length>1?r[1].length:0}function a(t,e){var r=parseInt((""+t).replace(".",""),10),n=parseInt((""+e).replace(".",""),10),u=i(t)+i(e);return r*n/Math.pow(10,u)}function o(t,e){var r=Math.max(i(t),i(e));return r=Math.pow(10,r),(a(t,r)+a(e,r))/r}function l(t,e){return o(t,-e)}function c(t,e){var r=i(t),n=i(e),u=parseInt((""+t).replace(".",""),10),a=parseInt((""+e).replace(".",""),10);return u/a*Math.pow(10,n-r)}function f(t,e,r){for(var n=t,u=[];n<e;)u.push(n),n=o(n,r);return u}Object.defineProperty(e,"__esModule",{value:!0});var p=r(1),s=(0,p.curry)(function(t,e,r){var n=+t,u=+e;return n+r*(u-n)}),v=(0,p.curry)(function(t,e,r){var n=e-+t;return n=n||1/0,(r-t)/n}),d=(0,p.curry)(function(t,e,r){var n=e-+t;return n=n||1/0,Math.max(0,Math.min(1,(r-t)/n))});e.default={rangeStep:f,isFloat:n,getDigitCount:u,getDecimalDigitCount:i,sum:o,minus:l,multiply:a,divide:c,interpolateNumber:s,uninterpolateNumber:v,uninterpolateTruncation:d}}])});
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.RechartsScale=e():t.RechartsScale=e()}(this,function(){return function(t){function e(n){if(r[n])return r[n].exports;var u=r[n]={exports:{},id:n,loaded:!1};return t[n].call(u.exports,u,u.exports,e),u.loaded=!0,u.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(2);Object.defineProperty(e,"getTickValues",{enumerable:!0,get:function(){return n.getTickValues}}),Object.defineProperty(e,"getNiceTickValues",{enumerable:!0,get:function(){return n.getNiceTickValues}})},function(t,e){"use strict";function r(t){if(Array.isArray(t)){for(var e=0,r=Array(t.length);e<t.length;e++)r[e]=t[e];return r}return Array.from(t)}Object.defineProperty(e,"__esModule",{value:!0});var n=function(t){return t},u=e.PLACE_HOLDER={"@@functional/placeholder":!0},a=function(t){return t===u},i=function(t){return function e(){return 0===arguments.length||1===arguments.length&&a(arguments.length<=0?void 0:arguments[0])?e:t.apply(void 0,arguments)}},o=function t(e,n){return 1===e?n:i(function(){for(var o=arguments.length,l=Array(o),f=0;f<o;f++)l[f]=arguments[f];var c=l.filter(function(t){return t!==u}).length;return c>=e?n.apply(void 0,l):t(e-c,i(function(){for(var t=arguments.length,e=Array(t),u=0;u<t;u++)e[u]=arguments[u];var i=l.map(function(t){return a(t)?e.shift():t});return n.apply(void 0,r(i).concat(e))}))})},l=e.curry=function(t){return o(t.length,t)};e.range=function(t,e){for(var r=[],n=t;n<e;++n)r[n-t]=n;return r},e.map=l(function(t,e){return Array.isArray(e)?e.map(t):Object.keys(e).map(function(t){return e[t]}).map(t)}),e.compose=function(){for(var t=arguments.length,e=Array(t),r=0;r<t;r++)e[r]=arguments[r];if(!e.length)return n;var u=e.reverse(),a=u[0],i=u.slice(1);return function(){return i.reduce(function(t,e){return e(t)},a.apply(void 0,arguments))}},e.reverse=function(t){return Array.isArray(t)?t.reverse():t.split("").reverse.join("")},e.memoize=function(t){var e=null,r=null;return function(){for(var n=arguments.length,u=Array(n),a=0;a<n;a++)u[a]=arguments[a];return e&&u.every(function(t,r){return t===e[r]})?r:(e=u,r=t.apply(void 0,u))}}},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function u(t){var e=c(t,2),r=e[0],n=e[1],u=r,a=n;return r>n&&(u=n,a=r),[u,a]}function a(t,e,r){if(t<=0)return 0;var n=v.default.getDigitCount(t),u=t/Math.pow(10,n),a=1!==n?v.default.multiply(Math.ceil(u/.05)+r,.05):v.default.multiply(Math.ceil(u/.1)+r,.1),i=v.default.multiply(a,Math.pow(10,n));return e?i:Math.ceil(i)}function i(t,e,r){var n=v.default.isFloat(t),u=1,a=t;if(n&&r){var i=Math.abs(t);i<1?(u=Math.pow(10,v.default.getDigitCount(t)-1),a=v.default.multiply(Math.floor(t/u),u)):i>1&&(a=Math.floor(t))}else 0===t?a=Math.floor((e-1)/2):r||(a=Math.floor(t));var o=Math.floor((e-1)/2),l=(0,s.compose)((0,s.map)(function(t){return v.default.sum(a,v.default.multiply(t-o,u))}),s.range);return l(0,e)}function o(t,e,r,n){var u=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,i=a((e-t)/(r-1),n,u),l=void 0;t<=0&&e>=0?l=0:(l=v.default.divide(v.default.sum(t,e),2),l=v.default.minus(l,v.default.modulo(l,i)));var f=Math.ceil((l-t)/i),c=Math.ceil((e-l)/i),s=f+c+1;return s>r?o(t,e,r,n,u+1):(s<r&&(c=e>0?c+(r-s):c,f=e>0?f:f+(r-s)),{step:i,tickMin:v.default.minus(l,v.default.multiply(f,i)),tickMax:v.default.sum(l,v.default.multiply(c,i))})}function l(t){var e=c(t,2),r=e[0],n=e[1],a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6,l=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],f=Math.max(a,2),p=u([r,n]),d=c(p,2),h=d[0],m=d[1];if(h===m)return i(h,a,l);var y=o(h,m,f,l),g=y.step,M=y.tickMin,b=y.tickMax,x=v.default.rangeStep(M,b+.1*g,g);return r>n?(0,s.reverse)(x):x}function f(t){var e=c(t,2),r=e[0],n=e[1],o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6,l=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],f=Math.max(o,2),p=u([r,n]),v=c(p,2),d=v[0],h=v[1];if(d===h)return i(d,o,l);var m=a((h-d)/(f-1),l,0),y=(0,s.compose)((0,s.map)(function(t){return d+t*m}),s.range),g=y(0,f).filter(function(t){return t>=d&&t<=h});return r>n?(0,s.reverse)(g):g}Object.defineProperty(e,"__esModule",{value:!0}),e.getTickValues=e.getNiceTickValues=void 0;var c=function(){function t(t,e){var r=[],n=!0,u=!1,a=void 0;try{for(var i,o=t[Symbol.iterator]();!(n=(i=o.next()).done)&&(r.push(i.value),!e||r.length!==e);n=!0);}catch(t){u=!0,a=t}finally{try{!n&&o.return&&o.return()}finally{if(u)throw a}}return r}return function(e,r){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),s=r(1),p=r(3),v=n(p);e.getNiceTickValues=(0,s.memoize)(l),e.getTickValues=(0,s.memoize)(f)},function(t,e,r){"use strict";function n(t){return/^([+-]?)\d*\.\d+$/.test(t)}function u(t){var e=Math.abs(t),r=void 0;if(0===t)r=1;else if(e<1)r=Math.floor(Math.log(e)/Math.log(10))+1;else{var n=""+t,u=n.split(".");r=u[0].length}return r}function a(t){var e=t?""+t:"",r=e.split(".");return r.length>1?r[1].length:0}function i(t,e){var r=parseInt((""+t).replace(".",""),10),n=parseInt((""+e).replace(".",""),10),u=a(t)+a(e);return r*n/Math.pow(10,u)}function o(t,e){var r=Math.max(a(t),a(e));return r=Math.pow(10,r),(i(t,r)+i(e,r))/r}function l(t,e){return o(t,-e)}function f(t,e){var r=a(t),n=a(e),u=parseInt((""+t).replace(".",""),10),i=parseInt((""+e).replace(".",""),10);return u/i*Math.pow(10,n-r)}function c(t,e){var r=Math.abs(e);if(e<=0)return t;var n=Math.floor(t/r);return l(t,i(r,n))}function s(t,e,r){for(var n=t,u=[];n<e;)u.push(n),n=o(n,r);return u}Object.defineProperty(e,"__esModule",{value:!0});var p=r(1),v=(0,p.curry)(function(t,e,r){var n=+t,u=+e;return n+r*(u-n)}),d=(0,p.curry)(function(t,e,r){var n=e-+t;return n=n||1/0,(r-t)/n}),h=(0,p.curry)(function(t,e,r){var n=e-+t;return n=n||1/0,Math.max(0,Math.min(1,(r-t)/n))});e.default={rangeStep:s,isFloat:n,getDigitCount:u,getDecimalDigitCount:a,sum:o,minus:l,multiply:i,divide:f,modulo:c,interpolateNumber:v,uninterpolateNumber:d,uninterpolateTruncation:h}}])});
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