11/**
22 * linear-converter - Copyright 2015 Javier Cejudo <javier@javiercejudo.com> (http://www.javiercejudo.com)
3- * @version v4.0.0
3+ * @version v4.0.1
44 * @link https://github.com/javiercejudo/linear-converter#readme
55 * @license MIT
66 */
@@ -73,15 +73,11 @@ module.exports = function factory(Decimal) {
7373 var api = { } ;
7474
7575 api . normalise = function normalise ( x , scale ) {
76- var xDecimal = new Decimal ( x . toString ( ) ) ;
77-
78- if ( isUndefined ( scale ) ) {
79- return xDecimal ;
80- }
76+ scale = scale || [ 0 , 1 ] ;
8177
8278 var scale0 = new Decimal ( scale [ 0 ] . toString ( ) ) ;
8379
84- return xDecimal . minus ( scale0 )
80+ return new Decimal ( x . toString ( ) ) . minus ( scale0 )
8581 . div ( new Decimal ( scale [ 1 ] . toString ( ) ) . minus ( scale0 ) ) ;
8682 } ;
8783
@@ -99,9 +95,7 @@ module.exports = function factory(Decimal) {
9995 var api = { } ;
10096
10197 api . scale = function scaleNormalised ( x , scale ) {
102- if ( isUndefined ( scale ) ) {
103- return x ;
104- }
98+ scale = scale || [ 0 , 1 ] ;
10599
106100 var scale0 = new Decimal ( scale [ 0 ] . toString ( ) ) ;
107101
@@ -110,7 +104,7 @@ module.exports = function factory(Decimal) {
110104 } ;
111105
112106 return api ;
113- }
107+ } ;
114108
115109} , { "lodash.isundefined" :2 } ] , 5 :[ function ( require , module , exports ) {
116110/*jshint node:true */
@@ -127,10 +121,6 @@ module.exports = function factory(Decimal) {
127121 var api = { } ;
128122
129123 api . rescale = function rescale ( x , oldScale , newScale ) {
130- if ( isUndefined ( newScale ) ) {
131- return normalise ( x , oldScale ) ;
132- }
133-
134124 return scale ( normalise ( x , oldScale ) , newScale ) ;
135125 } ;
136126
0 commit comments