@formio/text-mask-addons
Version:
Addons for Text Mask https://github.com/text-mask/text-mask
1 lines • 3.32 kB
JavaScript
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.createNumberMask=t():e.createNumberMask=t()}(this,function(){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){e.exports=r(2)},,function(e,t){"use strict";function r(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}function n(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:u,n=t.length;if(t===u||t[0]===b[0]&&1===n)return b.split(u).concat([m]).concat(x.split(u));if(t===O&&E)return b.split(u).concat(["0",O,m]).concat(x.split(u));var l=t[0]===d&&T;l&&(t=t.toString().substr(1));var f=t.lastIndexOf(O),s=f!==-1,g=void 0,S=void 0,A=void 0;if(t.slice(C*-1)===x&&(t=t.slice(0,C*-1)),s&&(E||L)?(g=t.slice(t.slice(0,z)===b?z:0,f),S=t.slice(f+1,n),S=o(S.replace(v,u))):g=t.slice(0,z)===b?t.slice(z):t,P&&("undefined"==typeof P?"undefined":c(P))===y){var N="."===j?"[.]":""+j,M=(g.match(new RegExp(N,"g"))||[]).length;g=g.slice(0,P+M*F)}if(g=g.replace(v,u),q||(g=g.replace(/^0+(0$|[^0])/,"$1")),g=w?i(g,j):g,A=o(g),(s&&E||L===!0)&&(t[f-1]!==O&&A.push(h),A.push(O,h),S&&(("undefined"==typeof k?"undefined":c(k))===y&&(S=S.slice(0,k)),A=A.concat(S)),L===!0&&t[f-1]===O&&A.push(m)),z>0&&(A=b.split(u).concat(A)),l&&(A.length===z&&A.push(m),A=[p].concat(A)),x.length>0&&(A=A.concat(x.split(u))),Z&&/[eE]/.test(t)){var $=t.split(/[eE]/),D=a($,2),I=D[0],_=D[1],B=I.match(/^[-+]?[0-9]*\.?[0-9]+/),R=_&&_.match(/^[-+]?[0-9]+$/);if(B&&(!_||R)){var G=e(B[0]),H=R?o(R[0]):[];return[].concat(r(G),["e"],r(H))}}return A}var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.prefix,b=void 0===n?l:n,g=t.suffix,x=void 0===g?u:g,S=t.includeThousandsSeparator,w=void 0===S||S,A=t.thousandsSeparatorSymbol,j=void 0===A?f:A,N=t.allowDecimal,E=void 0!==N&&N,M=t.decimalSymbol,O=void 0===M?s:M,$=t.decimalLimit,k=void 0===$?2:$,D=t.requireDecimal,L=void 0!==D&&D,I=t.allowNegative,T=void 0!==I&&I,_=t.allowLeadingZeroes,q=void 0!==_&&_,B=t.integerLimit,P=void 0===B?null:B,R=t.allowScientificNotation,Z=void 0===R||R,z=b&&b.length||0,C=x&&x.length||0,F=j&&j.length||0;return e.instanceOf="createNumberMask",e}function o(e){return e.split(u).map(function(e){return m.test(e)?m:e})}function i(e,t){return e.replace(/\B(?=(\d{3})+(?!\d))/g,t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){var r=[],n=!0,o=!1,i=void 0;try{for(var a,c=e[Symbol.iterator]();!(n=(a=c.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){o=!0,i=e}finally{try{!n&&c.return&&c.return()}finally{if(o)throw i}}return r}return function(t,r){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.default=n;var l="$",u="",f=",",s=".",d="-",p=/-/,v=/\D+/g,y="number",m=/\d/,h="[]"}])});