diff --git a/test.html b/test.html index 4d1ad50..9d24666 100644 --- a/test.html +++ b/test.html @@ -3,7 +3,7 @@ - +
diff --git a/wNumb.js b/wNumb.js index 0fdafcf..ce0b876 100644 --- a/wNumb.js +++ b/wNumb.js @@ -245,10 +245,10 @@ var if ( optionValue === undefined ) { // Only default if negativeBefore isn't set. - if ( optionName === 'negative' && !filteredOptions['negativeBefore'] ) { + if ( optionName === 'negative' && !filteredOptions.negativeBefore ) { filteredOptions[optionName] = '-'; // Don't set a default for mark when 'thousand' is set. - } else if ( optionName === 'mark' && filteredOptions['thousand'] !== '.' ) { + } else if ( optionName === 'mark' && filteredOptions.thousand !== '.' ) { filteredOptions[optionName] = '.'; } else { filteredOptions[optionName] = false; @@ -319,17 +319,17 @@ var options = validate(options); // Call 'formatTo' with proper arguments. - this['to'] = function ( input ) { + this.to = function ( input ) { return passAll(options, formatTo, input); }; // Call 'formatFrom' with proper arguments. - this['from'] = function ( input ) { + this.from = function ( input ) { return passAll(options, formatFrom, input); }; } /** @export */ - window['wNumb'] = wNumb; + window.wNumb = wNumb; }()); diff --git a/wNumb.min.js b/wNumb.min.js deleted file mode 100644 index c9cc55c..0000000 --- a/wNumb.min.js +++ /dev/null @@ -1,4 +0,0 @@ -(function(){function q(a){return a.split("").reverse().join("")}function r(a,e){return a.substring(0,e.length)===e}function s(a,e,c){if((a[e]||a[c])&&a[e]===a[c])throw Error(e);}function w(a,e,c,d,f,h,u,m,n,k,p,b){u=b;var l,g=p="";h&&(b=h(b));if("number"!==typeof b||!isFinite(b))return!1;a&&0===parseFloat(b.toFixed(a))&&(b=0);0>b&&(l=!0,b=Math.abs(b));!1!==a&&(h=b,b=Math.pow(10,a),b=(Math.round(h*b)/b).toFixed(a));b=b.toString();-1!==b.indexOf(".")?(a=b.split("."),h=a[0],c&&(p=c+a[1])):h=b;e&&(h= -q(h).match(/.{1,3}/g),h=q(h.join(q(e))));l&&m&&(g+=m);d&&(g+=d);l&&n&&(g+=n);g=g+h+p;f&&(g+=f);k&&(g=k(g,u));return g}function x(a,e,c,d,f,h,k,m,n,q,p,b){var l;a="";p&&(b=p(b));if(!b||"string"!==typeof b)return!1;m&&r(b,m)&&(b=b.replace(m,""),l=!0);d&&r(b,d)&&(b=b.replace(d,""));n&&r(b,n)&&(b=b.replace(n,""),l=!0);if(d=f)d=b.slice(-1*f.length)===f;d&&(b=b.slice(0,-1*f.length));e&&(b=b.split(e).join(""));c&&(b=b.replace(c,"."));l&&(a+="-");a=(a+b).replace(/[^0-9\.\-.]/g,"");if(""===a)return!1;a=Number(a); -k&&(a=k(a));return"number"===typeof a&&isFinite(a)?a:!1}function y(a){var e,c,d,f={};for(e=0;ed)f[c]=d;else throw Error(c);else if("encoder"===c||"decoder"===c||"edit"===c||"undo"===c)if("function"===typeof d)f[c]=d;else throw Error(c);else if("string"===typeof d)f[c]=d;else throw Error(c);s(f,"mark","thousand");s(f,"prefix","negative");s(f,"prefix", -"negativeBefore");return f}function v(a,e,c){var d,f=[];for(d=0;d