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

react-number-format

Package Overview
Dependencies
Maintainers
1
Versions
120
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-number-format - npm Package Compare versions

Comparing version 4.3.0 to 4.3.1

11

dist/react-number-format.es.js
/**
* react-number-format - 4.3.0
* react-number-format - 4.3.1
* Author : Sudhanshu Yadav

@@ -399,4 +399,3 @@ * Copyright (c) 2016, 2019 to Sudhanshu Yadav, released under the MIT license.

onBlur: noop,
isAllowed: returnTrue,
getInputRef: noop
isAllowed: returnTrue
};

@@ -1125,2 +1124,6 @@

if (this.focusTimeout) {
clearTimeout(this.focusTimeout);
}
if (!format) {

@@ -1274,3 +1277,3 @@ if (!allowLeadingZeros) {

this.focusedElm = e.target;
setTimeout(function () {
this.focusTimeout = setTimeout(function () {
var el = e.target;

@@ -1277,0 +1280,0 @@ var selectionStart = el.selectionStart,

/**
* react-number-format - 4.3.0
* react-number-format - 4.3.1
* Author : Sudhanshu Yadav

@@ -405,4 +405,3 @@ * Copyright (c) 2016, 2019 to Sudhanshu Yadav, released under the MIT license.

onBlur: noop,
isAllowed: returnTrue,
getInputRef: noop
isAllowed: returnTrue
};

@@ -1131,2 +1130,6 @@

if (this.focusTimeout) {
clearTimeout(this.focusTimeout);
}
if (!format) {

@@ -1280,3 +1283,3 @@ if (!allowLeadingZeros) {

this.focusedElm = e.target;
setTimeout(function () {
this.focusTimeout = setTimeout(function () {
var el = e.target;

@@ -1283,0 +1286,0 @@ var selectionStart = el.selectionStart,

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):(e=e||self).NumberFormat=t(e.React)}(this,function(f){"use strict";function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function c(){return(c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function o(e){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function r(e,t){return(r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function i(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}f=f&&f.hasOwnProperty("default")?f.default:f;function a(){}function s(){}s.resetWarningCache=a;var e,t=(function(e){e.exports=function(){function e(e,t,r,n,a,o){if("SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"!==o){var i=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw i.name="Invariant Violation",i}}function t(){return e}var r={array:e.isRequired=e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:s,resetWarningCache:a};return r.PropTypes=r}()}(e={exports:{}},e.exports),e.exports);function p(){}function h(e){return!!(e||"").match(/\d/)}function u(e){return e.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}function F(e){var t=!(1<arguments.length&&void 0!==arguments[1])||arguments[1],r="-"===e[0],n=r&&t,a=(e=e.replace("-","")).split(".");return{beforeDecimal:a[0],afterDecimal:a[1]||"",hasNagation:r,addNegation:n}}function m(e,t,r){for(var n="",a=r?"0":"",o=0;o<=t-1;o++)n+=e[o]||a;return n}function l(e,t){if(e.value=e.value,null!==e){if(e.createTextRange){var r=e.createTextRange();return r.move("character",t),r.select(),!0}return e.selectionStart||0===e.selectionStart?(e.focus(),e.setSelectionRange(t,t),!0):(e.focus(),!1)}}function g(e,t,r){return Math.min(Math.max(e,t),r)}function d(e){return Math.max(e.selectionStart,e.selectionEnd)}var v={thousandSeparator:t.oneOfType([t.string,t.oneOf([!0])]),decimalSeparator:t.string,allowedDecimalSeparators:t.arrayOf(t.string),thousandsGroupStyle:t.oneOf(["thousand","lakh","wan"]),decimalScale:t.number,fixedDecimalScale:t.bool,displayType:t.oneOf(["input","text"]),prefix:t.string,suffix:t.string,format:t.oneOfType([t.string,t.func]),removeFormatting:t.func,mask:t.oneOfType([t.string,t.arrayOf(t.string)]),value:t.oneOfType([t.number,t.string]),defaultValue:t.oneOfType([t.number,t.string]),isNumericString:t.bool,customInput:t.elementType,allowNegative:t.bool,allowEmptyFormatting:t.bool,allowLeadingZeros:t.bool,onValueChange:t.func,onKeyDown:t.func,onMouseUp:t.func,onChange:t.func,onFocus:t.func,onBlur:t.func,type:t.oneOf(["text","tel","password"]),isAllowed:t.func,renderText:t.func,getInputRef:t.func},y={displayType:"input",decimalSeparator:".",thousandsGroupStyle:"thousand",fixedDecimalScale:!1,prefix:"",suffix:"",allowNegative:!0,allowEmptyFormatting:!1,allowLeadingZeros:!1,isNumericString:!1,type:"text",onValueChange:p,onChange:p,onKeyDown:p,onMouseUp:p,onFocus:p,onBlur:p,isAllowed:function(){return!0},getInputRef:p},S=function(e){function a(e){var t;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a),t=function(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?i(e):t}(this,o(a).call(this,e));var r=e.defaultValue;t.validateProps();var n=t.formatValueProp(r);return t.state={value:n,numAsString:t.removeFormatting(n)},t.selectionBeforeInput={selectionStart:0,selectionEnd:0},t.onChange=t.onChange.bind(i(i(t))),t.onKeyDown=t.onKeyDown.bind(i(i(t))),t.onMouseUp=t.onMouseUp.bind(i(i(t))),t.onFocus=t.onFocus.bind(i(i(t))),t.onBlur=t.onBlur.bind(i(i(t))),t}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&r(e,t)}(a,f.Component),function(e,t,r){t&&n(e.prototype,t),r&&n(e,r)}(a,[{key:"componentDidUpdate",value:function(e){this.updateValueIfRequired(e)}},{key:"updateValueIfRequired",value:function(e){var t=this.props,r=this.state,n=this.focusedElm,a=r.value,o=r.numAsString,i=void 0===o?"":o;if(e!==t){this.validateProps();var s=this.formatNumString(i),u=void 0===t.value?s:this.formatValueProp(),l=this.removeFormatting(u),f=parseFloat(l),c=parseFloat(i);(isNaN(f)&&isNaN(c)||f===c)&&s===a&&(null!==n||u===a)||this.updateValue({formattedValue:u,numAsString:l,input:n})}}},{key:"getFloatString",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"",t=this.props.decimalScale,r=this.getSeparators().decimalSeparator,n=this.getNumberRegex(!0),a="-"===e[0];a&&(e=e.replace("-","")),r&&0===t&&(e=e.split(r)[0]);var o=(e=(e.match(n)||[]).join("").replace(r,".")).indexOf(".");return-1!==o&&(e="".concat(e.substring(0,o),".").concat(e.substring(o+1,e.length).replace(new RegExp(u(r),"g"),""))),a&&(e="-"+e),e}},{key:"getNumberRegex",value:function(e,t){var r=this.props,n=r.format,a=r.decimalScale,o=this.getSeparators().decimalSeparator;return new RegExp("\\d"+(!o||0===a||t||n?"":"|"+u(o)),e?"g":void 0)}},{key:"getSeparators",value:function(){var e=this.props.decimalSeparator,t=this.props,r=t.thousandSeparator,n=t.allowedDecimalSeparators;return!0===r&&(r=","),n||(n=[e,"."]),{decimalSeparator:e,thousandSeparator:r,allowedDecimalSeparators:n}}},{key:"getMaskAtIndex",value:function(e){var t=this.props.mask,r=void 0===t?" ":t;return"string"==typeof r?r:r[e]||" "}},{key:"getValueObject",value:function(e,t){var r=parseFloat(t);return{formattedValue:e,value:t,floatValue:isNaN(r)?void 0:r}}},{key:"validateProps",value:function(){var e=this.props.mask,t=this.getSeparators(),r=t.decimalSeparator,n=t.thousandSeparator;if(r===n)throw new Error("\n Decimal separator can't be same as thousand separator.\n thousandSeparator: ".concat(n,' (thousandSeparator = {true} is same as thousandSeparator = ",")\n decimalSeparator: ').concat(r," (default value for decimalSeparator is .)\n "));if(e&&("string"===e?e:e.toString()).match(/\d/g))throw new Error("\n Mask ".concat(e," should not contain numeric character;\n "))}},{key:"setPatchedCaretPosition",value:function(e,t,r){l(e,t),setTimeout(function(){e.value===r&&l(e,t)},0)}},{key:"correctCaretPosition",value:function(e,t,r){var n=this.props,a=n.prefix,o=n.suffix,i=n.format;if(""===e)return 0;if(t=g(t,0,e.length),!i){var s="-"===e[0];return g(t,a.length+(s?1:0),e.length-o.length)}if("function"==typeof i)return t;if("#"===i[t]&&h(e[t]))return t;if("#"===i[t-1]&&h(e[t-1]))return t;var u=i.indexOf("#");t=g(t,u,i.lastIndexOf("#")+1);for(var l=i.substring(t,i.length).indexOf("#"),f=t,c=t+(-1===l?0:l);u<f&&("#"!==i[f]||!h(e[f]));)f-=1;return!h(e[c])||"left"===r&&t!==u||t-f<c-t?h(e[f])?f+1:f:c}},{key:"getCaretPosition",value:function(e,t,r){var n,a,o=this.props.format,i=this.state.value,s=this.getNumberRegex(!0),u=(e.match(s)||[]).join(""),l=(t.match(s)||[]).join("");for(a=n=0;a<r;a++){var f=e[a]||"",c=t[n]||"";if((f.match(s)||f===c)&&("0"!==f||!c.match(s)||"0"===c||u.length===l.length)){for(;f!==t[n]&&n<t.length;)n++;n++}}return"string"!=typeof o||i||(n=t.length),n=this.correctCaretPosition(t,n)}},{key:"removePrefixAndSuffix",value:function(e){var t=this.props,r=t.format,n=t.prefix,a=t.suffix;if(!r&&e){var o="-"===e[0];o&&(e=e.substring(1,e.length));var i=(e=n&&0===e.indexOf(n)?e.substring(n.length,e.length):e).lastIndexOf(a);e=a&&-1!==i&&i===e.length-a.length?e.substring(0,i):e,o&&(e="-"+e)}return e}},{key:"removePatternFormatting",value:function(e){for(var t=this.props.format.split("#").filter(function(e){return""!==e}),r=0,n="",a=0,o=t.length;a<=o;a++){var i=t[a]||"",s=a===o?e.length:e.indexOf(i,r);if(-1===s){n=e;break}n+=e.substring(r,s),r=s+i.length}return(n.match(/\d/g)||[]).join("")}},{key:"removeFormatting",value:function(e){var t=this.props,r=t.format,n=t.removeFormatting;return e?e=r?"string"==typeof r?this.removePatternFormatting(e):"function"==typeof n?n(e):(e.match(/\d/g)||[]).join(""):(e=this.removePrefixAndSuffix(e),this.getFloatString(e)):e}},{key:"formatWithPattern",value:function(e){for(var t=this.props.format,r=0,n=t.split(""),a=0,o=t.length;a<o;a++)"#"===t[a]&&(n[a]=e[r]||this.getMaskAtIndex(r),r+=1);return n.join("")}},{key:"formatAsNumber",value:function(e){var t=this.props,r=t.decimalScale,n=t.fixedDecimalScale,a=t.prefix,o=t.suffix,i=t.allowNegative,s=t.thousandsGroupStyle,u=this.getSeparators(),l=u.thousandSeparator,f=u.decimalSeparator,c=-1!==e.indexOf(".")||r&&n,p=F(e,i),h=p.beforeDecimal,g=p.afterDecimal,d=p.addNegation;return void 0!==r&&(g=m(g,r,n)),l&&(h=function(e,t,r){var n=function(e){switch(e){case"lakh":return/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/g;case"wan":return/(\d)(?=(\d{4})+(?!\d))/g;case"thousand":default:return/(\d)(?=(\d{3})+(?!\d))/g}}(r),a=e.search(/[1-9]/);return a=-1===a?e.length:a,e.substring(0,a)+e.substring(a,e.length).replace(n,"$1"+t)}(h,l,s)),a&&(h=a+h),o&&(g+=o),d&&(h="-"+h),e=h+(c&&f||"")+g}},{key:"formatNumString",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"",t=this.props,r=t.format,n=t.allowEmptyFormatting,a=e;return a=""!==e||n?"-"!==e||r?"string"==typeof r?this.formatWithPattern(a):"function"==typeof r?r(a):this.formatAsNumber(a):"-":""}},{key:"formatValueProp",value:function(e){var t=this.props,r=t.format,n=t.decimalScale,a=t.fixedDecimalScale,o=t.allowEmptyFormatting,i=this.props,s=i.value,u=void 0===s?e:s,l=i.isNumericString,f=!u&&0!==u;return f&&o&&(u=""),f&&!o?"":("number"==typeof u&&(u=u.toString(),l=!0),"Infinity"===u&&l&&(u=""),l&&!r&&"number"==typeof n&&(u=function(e,t,r){if(-1!==["","-"].indexOf(e))return e;var n=-1!==e.indexOf(".")&&t,a=F(e),o=a.beforeDecimal,i=a.afterDecimal,s=a.hasNagation,u=parseFloat("0.".concat(i||"0")).toFixed(t).split("."),l=o.split("").reverse().reduce(function(e,t,r){return e.length>r?(Number(e[0])+Number(t)).toString()+e.substring(1,e.length):t+e},u[0]),f=m(u[1]||"",Math.min(t,i.length),r),c=n?".":"";return"".concat(s?"-":"").concat(l).concat(c).concat(f)}(u,n,a)),l?this.formatNumString(u):this.formatInput(u))}},{key:"formatNegation",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"",t=this.props.allowNegative,r=new RegExp("(-)"),n=new RegExp("(-)(.)*(-)"),a=r.test(e),o=n.test(e);return e=e.replace(/-/g,""),a&&!o&&t&&(e="-"+e),e}},{key:"formatInput",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"";return this.props.format||(e=this.removePrefixAndSuffix(e),e=this.formatNegation(e)),e=this.removeFormatting(e),this.formatNumString(e)}},{key:"isCharacterAFormat",value:function(e,t){var r=this.props,n=r.format,a=r.prefix,o=r.suffix,i=r.decimalScale,s=r.fixedDecimalScale,u=this.getSeparators().decimalSeparator;return"string"==typeof n&&"#"!==n[e]||!(n||!(e<a.length||e>=t.length-o.length||i&&s&&t[e]===u))}},{key:"checkIfFormatGotDeleted",value:function(e,t,r){for(var n=e;n<t;n++)if(this.isCharacterAFormat(n,r))return!0;return!1}},{key:"correctInputValue",value:function(e,t,r){var n=this.props,a=n.format,o=n.allowNegative,i=n.prefix,s=n.suffix,u=this.getSeparators(),l=u.allowedDecimalSeparators,f=u.decimalSeparator,c=this.state.numAsString||"",p=this.selectionBeforeInput,h=p.selectionStart,g=p.selectionEnd,d=function(e,t){for(var r=0,n=0,a=e.length,o=t.length;e[r]===t[r]&&r<a;)r++;for(;e[a-1-n]===t[o-1-n]&&r<o-n&&r<a-n;)n++;return{start:r,end:a-n}}(t,r),m=d.start,v=d.end;if(!a&&m===v&&-1!==l.indexOf(r[h]))return r.substr(0,h)+f+r.substr(h+1,r.length);var y=a?0:i.length,S=t.length-(a?0:s.length);if(r.length>t.length||!r.length||m===v||0===h&&g===t.length||h===y&&g===S)return r;if(this.checkIfFormatGotDeleted(m,v,t)&&(r=t),!a){var b=this.removeFormatting(r),x=F(b,o),w=x.beforeDecimal,O=x.afterDecimal,k=x.addNegation,P=e<r.indexOf(f)+1;if(b.length<c.length&&P&&""===w&&!parseFloat(O))return k?"-":""}return r}},{key:"updateValue",value:function(e){var t=this,r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:p,n=e.formattedValue,a=e.input,o=e.numAsString,i=e.caretPos,s=this.props.onValueChange,u=this.state.value;if(a){if(!i){var l=e.inputValue||a.value,f=d(a);i=this.getCaretPosition(l,n,f)}a.value=n,this.setPatchedCaretPosition(a,i,n)}void 0===o&&(o=this.removeFormatting(n)),n!==u?this.setState({value:n,numAsString:o},function(){s(t.getValueObject(n,o)),r()}):r()}},{key:"onChange",value:function(e){e.persist();var t=e.target,r=t.value,n=this.state,a=this.props,o=a.isAllowed,i=n.value||"",s=d(t);r=this.correctInputValue(s,i,r);var u=this.formatInput(r)||"",l=this.removeFormatting(u);o(this.getValueObject(u,l))||(u=i),this.updateValue({formattedValue:u,numAsString:l,inputValue:r,input:t},function(){a.onChange(e)})}},{key:"onBlur",value:function(e){var t=this.props,r=this.state,n=t.format,a=t.onBlur,o=t.allowLeadingZeros,i=r.numAsString,s=r.value;if(this.focusedElm=null,!n){o||(i=function(e){if(!e)return e;var t="-"===e[0];t&&(e=e.substring(1,e.length));var r=e.split("."),n=r[0].replace(/^0+/,"")||"0",a=r[1]||"";return"".concat(t?"-":"").concat(n).concat(a?".".concat(a):"")}(i));var u=this.formatNumString(i);if(u!==s)return e.persist(),void this.updateValue({formattedValue:u,numAsString:i},function(){a(e)})}a(e)}},{key:"onKeyDown",value:function(e){var t,r=e.target,n=e.key,a=r.selectionStart,o=r.selectionEnd,i=r.value,s=void 0===i?"":i,u=this.props,l=u.decimalScale,f=u.fixedDecimalScale,c=u.prefix,p=u.suffix,h=u.format,g=u.onKeyDown,d=(u.onValueChange,void 0!==l&&f),m=this.getNumberRegex(!1,d),v=new RegExp("-"),y="string"==typeof h;if(this.selectionBeforeInput={selectionStart:a,selectionEnd:o},"ArrowLeft"===n||"Backspace"===n?t=a-1:"ArrowRight"===n?t=a+1:"Delete"===n&&(t=a),void 0!==t&&a===o){var S=t,b=y?h.indexOf("#"):c.length,x=y?h.lastIndexOf("#")+1:s.length-p.length;if("ArrowLeft"===n||"ArrowRight"===n){var w="ArrowLeft"===n?"left":"right";S=this.correctCaretPosition(s,t,w)}else if("Delete"!==n||m.test(s[t])||v.test(s[t])){if("Backspace"===n&&!m.test(s[t]))if(a<=b+1&&"-"===s[0]&&void 0===h){var O=s.substring(1);e.persist(),this.updateValue({formattedValue:O,caretPos:S,input:r})}else if(!v.test(s[t])){for(;!m.test(s[S-1])&&b<S;)S--;S=this.correctCaretPosition(s,S,"left")}}else for(;!m.test(s[S])&&S<x;)S++;(S!==t||t<b||x<t)&&(e.preventDefault(),this.setPatchedCaretPosition(r,S,s)),e.isUnitTestRun&&this.setPatchedCaretPosition(r,S,s),this.props.onKeyDown(e)}else g(e)}},{key:"onMouseUp",value:function(e){var t=e.target,r=t.selectionStart,n=t.selectionEnd,a=t.value,o=void 0===a?"":a;if(r===n){var i=this.correctCaretPosition(o,r);i!==r&&this.setPatchedCaretPosition(t,i,o)}this.props.onMouseUp(e)}},{key:"onFocus",value:function(i){var s=this;i.persist(),this.focusedElm=i.target,setTimeout(function(){var e=i.target,t=e.selectionStart,r=e.selectionEnd,n=e.value,a=void 0===n?"":n,o=s.correctCaretPosition(a,t);o===t||0===t&&r===a.length||s.setPatchedCaretPosition(e,o,a),s.props.onFocus(i)},0)}},{key:"render",value:function(){var e=this.props,t=e.type,r=e.displayType,n=e.customInput,a=e.renderText,o=e.getInputRef,i=this.state.value,s=function(t,r){var n={};return Object.keys(t).forEach(function(e){r[e]||(n[e]=t[e])}),n}(this.props,v),u=c({},s,{type:t,value:i,onChange:this.onChange,onKeyDown:this.onKeyDown,onMouseUp:this.onMouseUp,onFocus:this.onFocus,onBlur:this.onBlur});if("text"===r)return a?a(i)||null:f.createElement("span",c({},s,{ref:o}),i);if(n){var l=n;return f.createElement(l,c({},u,{ref:o}))}return f.createElement("input",c({},u,{ref:o}))}}]),a}();return S.propTypes=v,S.defaultProps=y,S});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):(e=e||self).NumberFormat=t(e.React)}(this,function(c){"use strict";function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function f(){return(f=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function o(e){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function r(e,t){return(r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function i(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}c=c&&c.hasOwnProperty("default")?c.default:c;function a(){}function s(){}s.resetWarningCache=a;var e,t=(function(e){e.exports=function(){function e(e,t,r,n,a,o){if("SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"!==o){var i=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw i.name="Invariant Violation",i}}function t(){return e}var r={array:e.isRequired=e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:s,resetWarningCache:a};return r.PropTypes=r}()}(e={exports:{}},e.exports),e.exports);function p(){}function h(e){return!!(e||"").match(/\d/)}function u(e){return e.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}function F(e){var t=!(1<arguments.length&&void 0!==arguments[1])||arguments[1],r="-"===e[0],n=r&&t,a=(e=e.replace("-","")).split(".");return{beforeDecimal:a[0],afterDecimal:a[1]||"",hasNagation:r,addNegation:n}}function d(e,t,r){for(var n="",a=r?"0":"",o=0;o<=t-1;o++)n+=e[o]||a;return n}function l(e,t){if(e.value=e.value,null!==e){if(e.createTextRange){var r=e.createTextRange();return r.move("character",t),r.select(),!0}return e.selectionStart||0===e.selectionStart?(e.focus(),e.setSelectionRange(t,t),!0):(e.focus(),!1)}}function g(e,t,r){return Math.min(Math.max(e,t),r)}function m(e){return Math.max(e.selectionStart,e.selectionEnd)}var v={thousandSeparator:t.oneOfType([t.string,t.oneOf([!0])]),decimalSeparator:t.string,allowedDecimalSeparators:t.arrayOf(t.string),thousandsGroupStyle:t.oneOf(["thousand","lakh","wan"]),decimalScale:t.number,fixedDecimalScale:t.bool,displayType:t.oneOf(["input","text"]),prefix:t.string,suffix:t.string,format:t.oneOfType([t.string,t.func]),removeFormatting:t.func,mask:t.oneOfType([t.string,t.arrayOf(t.string)]),value:t.oneOfType([t.number,t.string]),defaultValue:t.oneOfType([t.number,t.string]),isNumericString:t.bool,customInput:t.elementType,allowNegative:t.bool,allowEmptyFormatting:t.bool,allowLeadingZeros:t.bool,onValueChange:t.func,onKeyDown:t.func,onMouseUp:t.func,onChange:t.func,onFocus:t.func,onBlur:t.func,type:t.oneOf(["text","tel","password"]),isAllowed:t.func,renderText:t.func,getInputRef:t.func},y={displayType:"input",decimalSeparator:".",thousandsGroupStyle:"thousand",fixedDecimalScale:!1,prefix:"",suffix:"",allowNegative:!0,allowEmptyFormatting:!1,allowLeadingZeros:!1,isNumericString:!1,type:"text",onValueChange:p,onChange:p,onKeyDown:p,onMouseUp:p,onFocus:p,onBlur:p,isAllowed:function(){return!0}},S=function(e){function a(e){var t;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a),t=function(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?i(e):t}(this,o(a).call(this,e));var r=e.defaultValue;t.validateProps();var n=t.formatValueProp(r);return t.state={value:n,numAsString:t.removeFormatting(n)},t.selectionBeforeInput={selectionStart:0,selectionEnd:0},t.onChange=t.onChange.bind(i(i(t))),t.onKeyDown=t.onKeyDown.bind(i(i(t))),t.onMouseUp=t.onMouseUp.bind(i(i(t))),t.onFocus=t.onFocus.bind(i(i(t))),t.onBlur=t.onBlur.bind(i(i(t))),t}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&r(e,t)}(a,c.Component),function(e,t,r){t&&n(e.prototype,t),r&&n(e,r)}(a,[{key:"componentDidUpdate",value:function(e){this.updateValueIfRequired(e)}},{key:"updateValueIfRequired",value:function(e){var t=this.props,r=this.state,n=this.focusedElm,a=r.value,o=r.numAsString,i=void 0===o?"":o;if(e!==t){this.validateProps();var s=this.formatNumString(i),u=void 0===t.value?s:this.formatValueProp(),l=this.removeFormatting(u),c=parseFloat(l),f=parseFloat(i);(isNaN(c)&&isNaN(f)||c===f)&&s===a&&(null!==n||u===a)||this.updateValue({formattedValue:u,numAsString:l,input:n})}}},{key:"getFloatString",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"",t=this.props.decimalScale,r=this.getSeparators().decimalSeparator,n=this.getNumberRegex(!0),a="-"===e[0];a&&(e=e.replace("-","")),r&&0===t&&(e=e.split(r)[0]);var o=(e=(e.match(n)||[]).join("").replace(r,".")).indexOf(".");return-1!==o&&(e="".concat(e.substring(0,o),".").concat(e.substring(o+1,e.length).replace(new RegExp(u(r),"g"),""))),a&&(e="-"+e),e}},{key:"getNumberRegex",value:function(e,t){var r=this.props,n=r.format,a=r.decimalScale,o=this.getSeparators().decimalSeparator;return new RegExp("\\d"+(!o||0===a||t||n?"":"|"+u(o)),e?"g":void 0)}},{key:"getSeparators",value:function(){var e=this.props.decimalSeparator,t=this.props,r=t.thousandSeparator,n=t.allowedDecimalSeparators;return!0===r&&(r=","),n||(n=[e,"."]),{decimalSeparator:e,thousandSeparator:r,allowedDecimalSeparators:n}}},{key:"getMaskAtIndex",value:function(e){var t=this.props.mask,r=void 0===t?" ":t;return"string"==typeof r?r:r[e]||" "}},{key:"getValueObject",value:function(e,t){var r=parseFloat(t);return{formattedValue:e,value:t,floatValue:isNaN(r)?void 0:r}}},{key:"validateProps",value:function(){var e=this.props.mask,t=this.getSeparators(),r=t.decimalSeparator,n=t.thousandSeparator;if(r===n)throw new Error("\n Decimal separator can't be same as thousand separator.\n thousandSeparator: ".concat(n,' (thousandSeparator = {true} is same as thousandSeparator = ",")\n decimalSeparator: ').concat(r," (default value for decimalSeparator is .)\n "));if(e&&("string"===e?e:e.toString()).match(/\d/g))throw new Error("\n Mask ".concat(e," should not contain numeric character;\n "))}},{key:"setPatchedCaretPosition",value:function(e,t,r){l(e,t),setTimeout(function(){e.value===r&&l(e,t)},0)}},{key:"correctCaretPosition",value:function(e,t,r){var n=this.props,a=n.prefix,o=n.suffix,i=n.format;if(""===e)return 0;if(t=g(t,0,e.length),!i){var s="-"===e[0];return g(t,a.length+(s?1:0),e.length-o.length)}if("function"==typeof i)return t;if("#"===i[t]&&h(e[t]))return t;if("#"===i[t-1]&&h(e[t-1]))return t;var u=i.indexOf("#");t=g(t,u,i.lastIndexOf("#")+1);for(var l=i.substring(t,i.length).indexOf("#"),c=t,f=t+(-1===l?0:l);u<c&&("#"!==i[c]||!h(e[c]));)c-=1;return!h(e[f])||"left"===r&&t!==u||t-c<f-t?h(e[c])?c+1:c:f}},{key:"getCaretPosition",value:function(e,t,r){var n,a,o=this.props.format,i=this.state.value,s=this.getNumberRegex(!0),u=(e.match(s)||[]).join(""),l=(t.match(s)||[]).join("");for(a=n=0;a<r;a++){var c=e[a]||"",f=t[n]||"";if((c.match(s)||c===f)&&("0"!==c||!f.match(s)||"0"===f||u.length===l.length)){for(;c!==t[n]&&n<t.length;)n++;n++}}return"string"!=typeof o||i||(n=t.length),n=this.correctCaretPosition(t,n)}},{key:"removePrefixAndSuffix",value:function(e){var t=this.props,r=t.format,n=t.prefix,a=t.suffix;if(!r&&e){var o="-"===e[0];o&&(e=e.substring(1,e.length));var i=(e=n&&0===e.indexOf(n)?e.substring(n.length,e.length):e).lastIndexOf(a);e=a&&-1!==i&&i===e.length-a.length?e.substring(0,i):e,o&&(e="-"+e)}return e}},{key:"removePatternFormatting",value:function(e){for(var t=this.props.format.split("#").filter(function(e){return""!==e}),r=0,n="",a=0,o=t.length;a<=o;a++){var i=t[a]||"",s=a===o?e.length:e.indexOf(i,r);if(-1===s){n=e;break}n+=e.substring(r,s),r=s+i.length}return(n.match(/\d/g)||[]).join("")}},{key:"removeFormatting",value:function(e){var t=this.props,r=t.format,n=t.removeFormatting;return e?e=r?"string"==typeof r?this.removePatternFormatting(e):"function"==typeof n?n(e):(e.match(/\d/g)||[]).join(""):(e=this.removePrefixAndSuffix(e),this.getFloatString(e)):e}},{key:"formatWithPattern",value:function(e){for(var t=this.props.format,r=0,n=t.split(""),a=0,o=t.length;a<o;a++)"#"===t[a]&&(n[a]=e[r]||this.getMaskAtIndex(r),r+=1);return n.join("")}},{key:"formatAsNumber",value:function(e){var t=this.props,r=t.decimalScale,n=t.fixedDecimalScale,a=t.prefix,o=t.suffix,i=t.allowNegative,s=t.thousandsGroupStyle,u=this.getSeparators(),l=u.thousandSeparator,c=u.decimalSeparator,f=-1!==e.indexOf(".")||r&&n,p=F(e,i),h=p.beforeDecimal,g=p.afterDecimal,m=p.addNegation;return void 0!==r&&(g=d(g,r,n)),l&&(h=function(e,t,r){var n=function(e){switch(e){case"lakh":return/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/g;case"wan":return/(\d)(?=(\d{4})+(?!\d))/g;case"thousand":default:return/(\d)(?=(\d{3})+(?!\d))/g}}(r),a=e.search(/[1-9]/);return a=-1===a?e.length:a,e.substring(0,a)+e.substring(a,e.length).replace(n,"$1"+t)}(h,l,s)),a&&(h=a+h),o&&(g+=o),m&&(h="-"+h),e=h+(f&&c||"")+g}},{key:"formatNumString",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"",t=this.props,r=t.format,n=t.allowEmptyFormatting,a=e;return a=""!==e||n?"-"!==e||r?"string"==typeof r?this.formatWithPattern(a):"function"==typeof r?r(a):this.formatAsNumber(a):"-":""}},{key:"formatValueProp",value:function(e){var t=this.props,r=t.format,n=t.decimalScale,a=t.fixedDecimalScale,o=t.allowEmptyFormatting,i=this.props,s=i.value,u=void 0===s?e:s,l=i.isNumericString,c=!u&&0!==u;return c&&o&&(u=""),c&&!o?"":("number"==typeof u&&(u=u.toString(),l=!0),"Infinity"===u&&l&&(u=""),l&&!r&&"number"==typeof n&&(u=function(e,t,r){if(-1!==["","-"].indexOf(e))return e;var n=-1!==e.indexOf(".")&&t,a=F(e),o=a.beforeDecimal,i=a.afterDecimal,s=a.hasNagation,u=parseFloat("0.".concat(i||"0")).toFixed(t).split("."),l=o.split("").reverse().reduce(function(e,t,r){return e.length>r?(Number(e[0])+Number(t)).toString()+e.substring(1,e.length):t+e},u[0]),c=d(u[1]||"",Math.min(t,i.length),r),f=n?".":"";return"".concat(s?"-":"").concat(l).concat(f).concat(c)}(u,n,a)),l?this.formatNumString(u):this.formatInput(u))}},{key:"formatNegation",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"",t=this.props.allowNegative,r=new RegExp("(-)"),n=new RegExp("(-)(.)*(-)"),a=r.test(e),o=n.test(e);return e=e.replace(/-/g,""),a&&!o&&t&&(e="-"+e),e}},{key:"formatInput",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"";return this.props.format||(e=this.removePrefixAndSuffix(e),e=this.formatNegation(e)),e=this.removeFormatting(e),this.formatNumString(e)}},{key:"isCharacterAFormat",value:function(e,t){var r=this.props,n=r.format,a=r.prefix,o=r.suffix,i=r.decimalScale,s=r.fixedDecimalScale,u=this.getSeparators().decimalSeparator;return"string"==typeof n&&"#"!==n[e]||!(n||!(e<a.length||e>=t.length-o.length||i&&s&&t[e]===u))}},{key:"checkIfFormatGotDeleted",value:function(e,t,r){for(var n=e;n<t;n++)if(this.isCharacterAFormat(n,r))return!0;return!1}},{key:"correctInputValue",value:function(e,t,r){var n=this.props,a=n.format,o=n.allowNegative,i=n.prefix,s=n.suffix,u=this.getSeparators(),l=u.allowedDecimalSeparators,c=u.decimalSeparator,f=this.state.numAsString||"",p=this.selectionBeforeInput,h=p.selectionStart,g=p.selectionEnd,m=function(e,t){for(var r=0,n=0,a=e.length,o=t.length;e[r]===t[r]&&r<a;)r++;for(;e[a-1-n]===t[o-1-n]&&r<o-n&&r<a-n;)n++;return{start:r,end:a-n}}(t,r),d=m.start,v=m.end;if(!a&&d===v&&-1!==l.indexOf(r[h]))return r.substr(0,h)+c+r.substr(h+1,r.length);var y=a?0:i.length,S=t.length-(a?0:s.length);if(r.length>t.length||!r.length||d===v||0===h&&g===t.length||h===y&&g===S)return r;if(this.checkIfFormatGotDeleted(d,v,t)&&(r=t),!a){var b=this.removeFormatting(r),x=F(b,o),w=x.beforeDecimal,O=x.afterDecimal,k=x.addNegation,P=e<r.indexOf(c)+1;if(b.length<f.length&&P&&""===w&&!parseFloat(O))return k?"-":""}return r}},{key:"updateValue",value:function(e){var t=this,r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:p,n=e.formattedValue,a=e.input,o=e.numAsString,i=e.caretPos,s=this.props.onValueChange,u=this.state.value;if(a){if(!i){var l=e.inputValue||a.value,c=m(a);i=this.getCaretPosition(l,n,c)}a.value=n,this.setPatchedCaretPosition(a,i,n)}void 0===o&&(o=this.removeFormatting(n)),n!==u?this.setState({value:n,numAsString:o},function(){s(t.getValueObject(n,o)),r()}):r()}},{key:"onChange",value:function(e){e.persist();var t=e.target,r=t.value,n=this.state,a=this.props,o=a.isAllowed,i=n.value||"",s=m(t);r=this.correctInputValue(s,i,r);var u=this.formatInput(r)||"",l=this.removeFormatting(u);o(this.getValueObject(u,l))||(u=i),this.updateValue({formattedValue:u,numAsString:l,inputValue:r,input:t},function(){a.onChange(e)})}},{key:"onBlur",value:function(e){var t=this.props,r=this.state,n=t.format,a=t.onBlur,o=t.allowLeadingZeros,i=r.numAsString,s=r.value;if(this.focusedElm=null,this.focusTimeout&&clearTimeout(this.focusTimeout),!n){o||(i=function(e){if(!e)return e;var t="-"===e[0];t&&(e=e.substring(1,e.length));var r=e.split("."),n=r[0].replace(/^0+/,"")||"0",a=r[1]||"";return"".concat(t?"-":"").concat(n).concat(a?".".concat(a):"")}(i));var u=this.formatNumString(i);if(u!==s)return e.persist(),void this.updateValue({formattedValue:u,numAsString:i},function(){a(e)})}a(e)}},{key:"onKeyDown",value:function(e){var t,r=e.target,n=e.key,a=r.selectionStart,o=r.selectionEnd,i=r.value,s=void 0===i?"":i,u=this.props,l=u.decimalScale,c=u.fixedDecimalScale,f=u.prefix,p=u.suffix,h=u.format,g=u.onKeyDown,m=(u.onValueChange,void 0!==l&&c),d=this.getNumberRegex(!1,m),v=new RegExp("-"),y="string"==typeof h;if(this.selectionBeforeInput={selectionStart:a,selectionEnd:o},"ArrowLeft"===n||"Backspace"===n?t=a-1:"ArrowRight"===n?t=a+1:"Delete"===n&&(t=a),void 0!==t&&a===o){var S=t,b=y?h.indexOf("#"):f.length,x=y?h.lastIndexOf("#")+1:s.length-p.length;if("ArrowLeft"===n||"ArrowRight"===n){var w="ArrowLeft"===n?"left":"right";S=this.correctCaretPosition(s,t,w)}else if("Delete"!==n||d.test(s[t])||v.test(s[t])){if("Backspace"===n&&!d.test(s[t]))if(a<=b+1&&"-"===s[0]&&void 0===h){var O=s.substring(1);e.persist(),this.updateValue({formattedValue:O,caretPos:S,input:r})}else if(!v.test(s[t])){for(;!d.test(s[S-1])&&b<S;)S--;S=this.correctCaretPosition(s,S,"left")}}else for(;!d.test(s[S])&&S<x;)S++;(S!==t||t<b||x<t)&&(e.preventDefault(),this.setPatchedCaretPosition(r,S,s)),e.isUnitTestRun&&this.setPatchedCaretPosition(r,S,s),this.props.onKeyDown(e)}else g(e)}},{key:"onMouseUp",value:function(e){var t=e.target,r=t.selectionStart,n=t.selectionEnd,a=t.value,o=void 0===a?"":a;if(r===n){var i=this.correctCaretPosition(o,r);i!==r&&this.setPatchedCaretPosition(t,i,o)}this.props.onMouseUp(e)}},{key:"onFocus",value:function(i){var s=this;i.persist(),this.focusedElm=i.target,this.focusTimeout=setTimeout(function(){var e=i.target,t=e.selectionStart,r=e.selectionEnd,n=e.value,a=void 0===n?"":n,o=s.correctCaretPosition(a,t);o===t||0===t&&r===a.length||s.setPatchedCaretPosition(e,o,a),s.props.onFocus(i)},0)}},{key:"render",value:function(){var e=this.props,t=e.type,r=e.displayType,n=e.customInput,a=e.renderText,o=e.getInputRef,i=this.state.value,s=function(t,r){var n={};return Object.keys(t).forEach(function(e){r[e]||(n[e]=t[e])}),n}(this.props,v),u=f({},s,{type:t,value:i,onChange:this.onChange,onKeyDown:this.onKeyDown,onMouseUp:this.onMouseUp,onFocus:this.onFocus,onBlur:this.onBlur});if("text"===r)return a?a(i)||null:c.createElement("span",f({},s,{ref:o}),i);if(n){var l=n;return c.createElement(l,f({},u,{ref:o}))}return c.createElement("input",f({},u,{ref:o}))}}]),a}();return S.propTypes=v,S.defaultProps=y,S});

@@ -85,4 +85,3 @@ "use strict";

onBlur: _utils.noop,
isAllowed: _utils.returnTrue,
getInputRef: _utils.noop
isAllowed: _utils.returnTrue
};

@@ -811,2 +810,6 @@

if (this.focusTimeout) {
clearTimeout(this.focusTimeout);
}
if (!format) {

@@ -960,3 +963,3 @@ if (!allowLeadingZeros) {

this.focusedElm = e.target;
setTimeout(function () {
this.focusTimeout = setTimeout(function () {
var el = e.target;

@@ -963,0 +966,0 @@ var selectionStart = el.selectionStart,

{
"name": "react-number-format",
"description": "React component to format number in an input or as a text.",
"version": "4.3.0",
"version": "4.3.1",
"main": "lib/number_format.js",

@@ -38,52 +38,52 @@ "module": "dist/react-number-format.es.js",

"devDependencies": {
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.1",
"@babel/plugin-proposal-class-properties": "^7.0.0",
"@babel/plugin-proposal-object-rest-spread": "^7.0.0",
"@babel/plugin-transform-flow-strip-types": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/cli": "^7.6.2",
"@babel/core": "^7.6.2",
"@babel/plugin-proposal-class-properties": "^7.5.5",
"@babel/plugin-proposal-object-rest-spread": "^7.6.2",
"@babel/plugin-transform-flow-strip-types": "^7.4.4",
"@babel/preset-env": "^7.6.2",
"@babel/preset-react": "^7.0.0",
"@babel/register": "^7.0.0",
"@types/react": "^16.4.18",
"babel-eslint": "^9.0.0",
"babel-loader": "^8.0.2",
"babel-plugin-add-module-exports": "^1.0.0",
"@babel/register": "^7.6.2",
"@types/react": "^16.9.4",
"babel-eslint": "^10.0.3",
"babel-loader": "^8.0.6",
"babel-plugin-add-module-exports": "^1.0.2",
"babel-plugin-transform-object-assign": "^6.22.0",
"classnames": "^2.2.3",
"cross-env": "^3.1.4",
"enzyme": "^3.6.0",
"enzyme-adapter-react-16": "^1.5.0",
"eslint": "^5.16.0",
"eslint-loader": "^2.1.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-react": "^7.11.1",
"flow-bin": "0.54.1",
"classnames": "^2.2.6",
"cross-env": "^6.0.3",
"enzyme": "^3.10.0",
"enzyme-adapter-react-16": "^1.14.0",
"eslint": "^6.5.1",
"eslint-loader": "^3.0.2",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-react": "^7.15.1",
"flow-bin": "0.109.0",
"jasmine": "^2.4.1",
"jasmine-core": "^2.4.1",
"karma": "^3.0.0",
"karma-chrome-launcher": "^2.2.0",
"karma-cli": "^1.0.1",
"karma": "^4.3.0",
"karma-chrome-launcher": "^3.1.0",
"karma-cli": "^2.0.0",
"karma-jasmine": "^0.3.7",
"karma-jasmine-html-reporter": "^0.2.0",
"karma-rollup-preprocessor": "^6.0.1",
"karma-rollup-preprocessor": "^7.0.2",
"karma-sourcemap-loader": "^0.3.7",
"karma-spec-reporter": "^0.0.32",
"karma-webpack": "^3.0.5",
"material-ui": "^0.19.2",
"karma-webpack": "^4.0.2",
"material-ui": "^0.20.2",
"react": "^15.4.0 || ^16.0.0",
"react-dom": "^15.4.0 || ^16.0.0",
"react-router": "3",
"react-router": "5",
"react-transform-hmr": "^1.0.4",
"rollup": "^1.11.3",
"rollup-plugin-babel": "^4.3.2",
"rollup-plugin-commonjs": "^9.3.4",
"rollup-plugin-filesize": "^6.0.1",
"rollup-plugin-license": "^0.8.1",
"rollup-plugin-node-resolve": "^4.2.3",
"rollup": "^1.22.0",
"rollup-plugin-babel": "^4.3.3",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-filesize": "^6.2.0",
"rollup-plugin-license": "^0.12.1",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-replace": "^2.2.0",
"rollup-plugin-uglify": "^6.0.2",
"typescript": "^3.1.5",
"webpack": "^4.17.1",
"webpack-cli": "^3.1.0",
"webpack-dev-server": "^3.1.7"
"rollup-plugin-uglify": "^6.0.3",
"typescript": "^3.6.3",
"webpack": "^4.41.0",
"webpack-cli": "^3.3.9",
"webpack-dev-server": "^3.8.2"
},

@@ -97,2 +97,2 @@ "peerDependencies": {

}
}
}

@@ -289,7 +289,8 @@ # react-number-format

### Development
- Download the zip
- `npm install`
- `npm start` to run example server
- `npm run test` to test changes
- `npm run bundle` to bundle files
- Clone the repository or download the zip
- `npm i -g yarn` to download Yarn
- `yarn` to install dependencies
- `yarn start` to run example server
- `yarn test` to test changes
- `yarn bundle` to bundle files

@@ -299,2 +300,2 @@ #### Testing

Test file : /test/test_input.js
To run test : `npm run test`
To run test : `yarn test`

@@ -61,2 +61,3 @@ /// <reference types="react" />

getInputRef?: ((el: HTMLInputElement) => void) | React.Ref<any>;
allowedDecimalSeparators?: Array<string>;
[key: string]: any;

@@ -63,0 +64,0 @@ }

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