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

redux-form-input-masks

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redux-form-input-masks - npm Package Compare versions

Comparing version 1.1.2 to 1.1.3

8

CHANGELOG.md

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

<a name="1.1.3"></a>
## [1.1.3](https://github.com/renato-bohler/redux-form-input-masks/compare/v1.1.2...v1.1.3) (2018-05-12)
### Bug Fixes
* **allowEmpty:** return empty string also when value is empty string ([894deeb](https://github.com/renato-bohler/redux-form-input-masks/commit/894deeb))
<a name="1.1.2"></a>

@@ -2,0 +10,0 @@ ## [1.1.2](https://github.com/renato-bohler/redux-form-input-masks/compare/v1.1.1...v1.1.2) (2018-05-08)

2

dist/bundle.js

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

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.library=t():e.library=t()}("undefined"!=typeof self?self:this,function(){return function(e){function t(n){if(r[n])return r[n].exports;var a=r[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,t),a.l=!0,a.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/dist/",t(t.s=1)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},a=function(e,t){return(e.match(t)||[]).length},o=function(e,t,r){return e.toLocaleString(t,{minimumFractionDigits:r,maximumFractionDigits:r})},i=function(e,t){return t[e]},u=function(e,t,r,n){for(var a="",o=e||"",u=0;u<o.length;u+=1){var c=o.charAt(u),f=t.charAt(u),s=i(f,n);s&&(s.regExp.test(c)?a=a.concat(c):c===r&&(o=""))}return a},c=function(e,t,r,n,a){for(var o="",u=e||"",c=0,f=0;f<t.length;f+=1){var s=u.charAt(c),l=t.charAt(f),p=i(l,a);if(p)if(s)if(p.regExp.test(s))o=o.concat(s),c+=1;else{if(!n)return o;o=o.concat(r),u=""}else{if(!n)return o;o=o.concat(r)}else o=o.concat(l)}return o},f=function(e,t,r,a,o){for(var u=e||"",f=0;f<t.length;f+=1){var s=t.charAt(f);if(!i(s,o)){var l=n(s);u=u.replace(new RegExp(l),"")}}var p=n(r);return u=u.replace(p,""),c(u,t,r,a,o)},s=function(e,t,r){if(!e||0===e.length)return!1;if(e.length!==t.length)return!1;for(var n=0;n<e.length;n+=1){var a=e.charAt(n),o=t.charAt(n),u=i(o,r);if(u){if(!u.regExp.test(a))return!1}else if(a!==o)return!1}return!0},l=function(e,t){var r=[];if(!e||"string"!=typeof e||0===e.length)return r;i(e.charAt(0),t)&&r.push(0);for(var n=1;n<e.length;n+=1){var a=e.charAt(n-1),o=e.charAt(n);(i(a,t)||i(o,t))&&r.push(n)}return i(e.charAt(e.length-1),t)&&r.push(e.length),r},p=function(e,t,r,n){if(""===e)return 0;for(var a=0;a<e.length;a+=1){var o=e.charAt(a),u=t.charAt(a);if(o===r&&o!==u)return a}if(e.length===t.length)for(var c=t.length-1;c>=0;c-=1){var f=t.charAt(c);if(i(f,n))return c+1}return e.length},v=function(e,t,r,n){for(var a=e||"",o=t||"",u="",c=0;c<a.length;c+=1){var f=a.charAt(c);if(f!==o.charAt(c)){var s=r.charAt(c),l=i(s,n);u=l&&l.transform?u.concat(l.transform(f)):u.concat(f)}else u=u.concat(f)}return u},h=function(e,t){for(var r=Object.keys(t),n=0;n<r.length;n+=1){var a=r[n];if(t[a].regExp.test(e))return a}};t.applyMask=c,t.applyTransform=v,t.countOcurrences=a,t.escapeRegExp=n,t.firstUnfilledPosition=p,t.getMaskDefinition=i,t.inputReformat=f,t.isPatternComplete=s,t.maskStrip=u,t.numberToLocaleString=o,t.charMatchTest=h,t.validCaretPositions=l},function(e,t,r){e.exports=r(2)},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.createTextMask=t.createNumberMask=void 0;var a=r(3),o=n(a),i=r(4),u=n(i);t.createNumberMask=o.default,t.createTextMask=u.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0);t.default=function(e){var t=e||{},r=t.prefix,a=void 0===r?"":r,o=t.suffix,i=void 0===o?"":o,u=t.decimalPlaces,c=void 0===u?0:u,f=t.stringValue,s=void 0!==f&&f,l=t.allowEmpty,p=void 0!==l&&l,v=t.allowNegative,h=void 0!==v&&v,g=t.showPlusSign,d=void 0!==g&&g,m=t.spaceAfterSign,x=void 0!==m&&m,k=t.locale,y=t.onChange;if(c>10)throw new Error("The maximum value for createNumberMask's option `decimalPlaces` is 10.");var b=function(e){var t=e;if(void 0===t){if(p)return"";t=0}else"number"!=typeof t&&(t=Number(t));var r=d?"+":"";return t<0&&(t*=-1,h&&(r="-")),r&&x&&(r+=" "),t=(0,n.numberToLocaleString)(t,k,c),""+r+a+t+i},w=function(e,t){var r=(0,n.escapeRegExp)(a),o=(0,n.escapeRegExp)(i),u=new RegExp("^[-|+]? ?"+r),f=new RegExp(o+"$");if(t&&(!u.test(e)||!f.test(e)))return t;var l=1;if(h){var v=/-/g,g=(0,n.countOcurrences)(e,v)-(0,n.countOcurrences)(a,v)-(0,n.countOcurrences)(i,v);l=Math.pow(-1,g)%2}var d=e;if(a&&(d=d.replace(u,"")),i&&(d=d.replace(f,"")),d=d.replace(/\D/g,""),p){var m=""===d,x=""===d.replace(/0+/g,""),k=d.length<=c,b=void 0===t;if(m||!b&&k&&x)return""}var w=Number(d)/Math.pow(10,c)*l;s&&(w=w.toString());var A=w!==t;return y&&A&&y(w),w},A=function(e){e.target&&(e.persist&&e.persist(),setTimeout(function(){var t=e.target.value.length-i.length;e.target.setSelectionRange(t,t)}))};return{format:function(e){return b(e)},normalize:function(e,t){return w(e,t)},onChange:function(e){return A(e)},onMouseDown:function(e){return A(e)},onFocus:function(e){return A(e)},onClick:function(e){return A(e)},autoComplete:"off"}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),a=r(5),o=function(e){return e&&e.__esModule?e:{default:e}}(a);t.default=function(e){var t=e.pattern,r=e.placeholder,a=void 0===r?"_":r,i=e.maskDefinitions,u=void 0===i?o.default:i,c=e.guide,f=void 0===c||c,s=e.stripMask,l=void 0===s||s,p=e.onChange,v=e.onCompletePattern;if(!t)throw new Error("The key `pattern` is required for createTextMask. You probably forgot to add it to your options.");if(!a||1!==a.length)throw new Error("The key `placeholder` should have a single character as a value.");var h=(0,n.validCaretPositions)(t,u);if(0===h.length)throw new Error("The pattern `"+t+"` passed for createTextMask is not valid.");var g=(0,n.charMatchTest)(a,u);if(g)throw new Error("The placeholder `"+a+"` matches the mask definition`"+g+"`. The mask created using `createTextMask`is therefore invalid.");var d=(0,n.maskStrip)(t,t,a,u),m=function(e){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return e?l||r?(0,n.applyMask)(e,t,a,f,u):e:(0,n.applyMask)("",t,a,f,u)},x=function(e,r){var o=(0,n.inputReformat)(e,t,a,f,u),i=(0,n.maskStrip)(o,t,a,u),c=(0,n.applyTransform)(i,l?r:(0,n.maskStrip)(r,t,a,u),d,u),s=m(c,!0),h=l?c:s,g=c!==r&&(""!==c||void 0!==r);return p&&g&&p(h),v&&(0,n.isPatternComplete)(s,t,u)&&g&&setTimeout(function(){return v(h)},10),h},k=function(e){var r=(0,n.firstUnfilledPosition)(e.value,t,a,u);e.setSelectionRange(r,r)},y=function(e,t,r){for(var n=void 0,a=0;a<=h.length;a+=1){if(h[a]>t){n=a;break}}var o=void 0;if(void 0===(o="left"===r?h[n-1]:h[n])){var i="left"===r?0:h.length-1;o=h[i]}e.setSelectionRange(o,o)},b=function(e){if(e.target){e.persist&&e.persist();var r=e.target.selectionStart,n=e.target.value;setTimeout(function(){var a=e.target,o=e.type,i=e.key,u=e.target,c=u.value,f=u.selectionStart,s=u.selectionEnd;switch(o){case"change":if(c.length===n.length+1&&c.charAt(r)===t.charAt(r)){y(a,r,"left");break}k(a);break;case"focus":k(a);break;case"click":f===s&&(h.indexOf(f)>=0?e.preventDefault():k(a));break;case"keydown":"ArrowLeft"===i?y(a,f,"left"):"ArrowRight"===i&&y(a,r,"right")}})}};return{format:function(e){return m(e)},normalize:function(e,t){return x(e,t)},onKeyDown:function(e){return b(e)},onChange:function(e){return b(e)},onFocus:function(e){return b(e)},onClick:function(e){return b(e)},autoComplete:"off"}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={A:{regExp:/[A-Za-z]/,transform:function(e){return e.toUpperCase()}},a:{regExp:/[A-Za-z]/,transform:function(e){return e.toLowerCase()}},U:{regExp:/[A-Z]/},l:{regExp:/[a-z]/},9:{regExp:/[0-9]/}}}])});
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.library=t():e.library=t()}("undefined"!=typeof self?self:this,function(){return function(e){function t(n){if(r[n])return r[n].exports;var a=r[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,t),a.l=!0,a.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/dist/",t(t.s=1)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},a=function(e,t){return(e.match(t)||[]).length},o=function(e,t,r){return e.toLocaleString(t,{minimumFractionDigits:r,maximumFractionDigits:r})},i=function(e,t){return t[e]},u=function(e,t,r,n){for(var a="",o=e||"",u=0;u<o.length;u+=1){var c=o.charAt(u),f=t.charAt(u),s=i(f,n);s&&(s.regExp.test(c)?a=a.concat(c):c===r&&(o=""))}return a},c=function(e,t,r,n,a){for(var o="",u=e||"",c=0,f=0;f<t.length;f+=1){var s=u.charAt(c),l=t.charAt(f),p=i(l,a);if(p)if(s)if(p.regExp.test(s))o=o.concat(s),c+=1;else{if(!n)return o;o=o.concat(r),u=""}else{if(!n)return o;o=o.concat(r)}else o=o.concat(l)}return o},f=function(e,t,r,a,o){for(var u=e||"",f=0;f<t.length;f+=1){var s=t.charAt(f);if(!i(s,o)){var l=n(s);u=u.replace(new RegExp(l),"")}}var p=n(r);return u=u.replace(p,""),c(u,t,r,a,o)},s=function(e,t,r){if(!e||0===e.length)return!1;if(e.length!==t.length)return!1;for(var n=0;n<e.length;n+=1){var a=e.charAt(n),o=t.charAt(n),u=i(o,r);if(u){if(!u.regExp.test(a))return!1}else if(a!==o)return!1}return!0},l=function(e,t){var r=[];if(!e||"string"!=typeof e||0===e.length)return r;i(e.charAt(0),t)&&r.push(0);for(var n=1;n<e.length;n+=1){var a=e.charAt(n-1),o=e.charAt(n);(i(a,t)||i(o,t))&&r.push(n)}return i(e.charAt(e.length-1),t)&&r.push(e.length),r},p=function(e,t,r,n){if(""===e)return 0;for(var a=0;a<e.length;a+=1){var o=e.charAt(a),u=t.charAt(a);if(o===r&&o!==u)return a}if(e.length===t.length)for(var c=t.length-1;c>=0;c-=1){var f=t.charAt(c);if(i(f,n))return c+1}return e.length},v=function(e,t,r,n){for(var a=e||"",o=t||"",u="",c=0;c<a.length;c+=1){var f=a.charAt(c);if(f!==o.charAt(c)){var s=r.charAt(c),l=i(s,n);u=l&&l.transform?u.concat(l.transform(f)):u.concat(f)}else u=u.concat(f)}return u},h=function(e,t){for(var r=Object.keys(t),n=0;n<r.length;n+=1){var a=r[n];if(t[a].regExp.test(e))return a}};t.applyMask=c,t.applyTransform=v,t.countOcurrences=a,t.escapeRegExp=n,t.firstUnfilledPosition=p,t.getMaskDefinition=i,t.inputReformat=f,t.isPatternComplete=s,t.maskStrip=u,t.numberToLocaleString=o,t.charMatchTest=h,t.validCaretPositions=l},function(e,t,r){e.exports=r(2)},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.createTextMask=t.createNumberMask=void 0;var a=r(3),o=n(a),i=r(4),u=n(i);t.createNumberMask=o.default,t.createTextMask=u.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0);t.default=function(e){var t=e||{},r=t.prefix,a=void 0===r?"":r,o=t.suffix,i=void 0===o?"":o,u=t.decimalPlaces,c=void 0===u?0:u,f=t.stringValue,s=void 0!==f&&f,l=t.allowEmpty,p=void 0!==l&&l,v=t.allowNegative,h=void 0!==v&&v,g=t.showPlusSign,d=void 0!==g&&g,m=t.spaceAfterSign,x=void 0!==m&&m,k=t.locale,y=t.onChange;if(c>10)throw new Error("The maximum value for createNumberMask's option `decimalPlaces` is 10.");var b=function(e){var t=e;if(void 0===t||""===t){if(p)return"";t=0}else"number"!=typeof t&&(t=Number(t));var r=d?"+":"";return t<0&&(t*=-1,h&&(r="-")),r&&x&&(r+=" "),t=(0,n.numberToLocaleString)(t,k,c),""+r+a+t+i},w=function(e,t){var r=(0,n.escapeRegExp)(a),o=(0,n.escapeRegExp)(i),u=new RegExp("^[-|+]? ?"+r),f=new RegExp(o+"$");if(t&&(!u.test(e)||!f.test(e)))return t;var l=1;if(h){var v=/-/g,g=(0,n.countOcurrences)(e,v)-(0,n.countOcurrences)(a,v)-(0,n.countOcurrences)(i,v);l=Math.pow(-1,g)%2}var d=e;if(a&&(d=d.replace(u,"")),i&&(d=d.replace(f,"")),d=d.replace(/\D/g,""),p){var m=""===d,x=""===d.replace(/0+/g,""),k=d.length<=c,b=void 0===t;if(m||!b&&k&&x)return""}var w=Number(d)/Math.pow(10,c)*l;s&&(w=w.toString());var A=w!==t;return y&&A&&y(w),w},A=function(e){e.target&&(e.persist&&e.persist(),setTimeout(function(){var t=e.target.value.length-i.length;e.target.setSelectionRange(t,t)}))};return{format:function(e){return b(e)},normalize:function(e,t){return w(e,t)},onChange:function(e){return A(e)},onMouseDown:function(e){return A(e)},onFocus:function(e){return A(e)},onClick:function(e){return A(e)},autoComplete:"off"}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),a=r(5),o=function(e){return e&&e.__esModule?e:{default:e}}(a);t.default=function(e){var t=e.pattern,r=e.placeholder,a=void 0===r?"_":r,i=e.maskDefinitions,u=void 0===i?o.default:i,c=e.guide,f=void 0===c||c,s=e.stripMask,l=void 0===s||s,p=e.onChange,v=e.onCompletePattern;if(!t)throw new Error("The key `pattern` is required for createTextMask. You probably forgot to add it to your options.");if(!a||1!==a.length)throw new Error("The key `placeholder` should have a single character as a value.");var h=(0,n.validCaretPositions)(t,u);if(0===h.length)throw new Error("The pattern `"+t+"` passed for createTextMask is not valid.");var g=(0,n.charMatchTest)(a,u);if(g)throw new Error("The placeholder `"+a+"` matches the mask definition`"+g+"`. The mask created using `createTextMask`is therefore invalid.");var d=(0,n.maskStrip)(t,t,a,u),m=function(e){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return e?l||r?(0,n.applyMask)(e,t,a,f,u):e:(0,n.applyMask)("",t,a,f,u)},x=function(e,r){var o=(0,n.inputReformat)(e,t,a,f,u),i=(0,n.maskStrip)(o,t,a,u),c=(0,n.applyTransform)(i,l?r:(0,n.maskStrip)(r,t,a,u),d,u),s=m(c,!0),h=l?c:s,g=c!==r&&(""!==c||void 0!==r);return p&&g&&p(h),v&&(0,n.isPatternComplete)(s,t,u)&&g&&setTimeout(function(){return v(h)},10),h},k=function(e){var r=(0,n.firstUnfilledPosition)(e.value,t,a,u);e.setSelectionRange(r,r)},y=function(e,t,r){for(var n=void 0,a=0;a<=h.length;a+=1){if(h[a]>t){n=a;break}}var o=void 0;if(void 0===(o="left"===r?h[n-1]:h[n])){var i="left"===r?0:h.length-1;o=h[i]}e.setSelectionRange(o,o)},b=function(e){if(e.target){e.persist&&e.persist();var r=e.target.selectionStart,n=e.target.value;setTimeout(function(){var a=e.target,o=e.type,i=e.key,u=e.target,c=u.value,f=u.selectionStart,s=u.selectionEnd;switch(o){case"change":if(c.length===n.length+1&&c.charAt(r)===t.charAt(r)){y(a,r,"left");break}k(a);break;case"focus":k(a);break;case"click":f===s&&(h.indexOf(f)>=0?e.preventDefault():k(a));break;case"keydown":"ArrowLeft"===i?y(a,f,"left"):"ArrowRight"===i&&y(a,r,"right")}})}};return{format:function(e){return m(e)},normalize:function(e,t){return x(e,t)},onKeyDown:function(e){return b(e)},onChange:function(e){return b(e)},onFocus:function(e){return b(e)},onClick:function(e){return b(e)},autoComplete:"off"}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={A:{regExp:/[A-Za-z]/,transform:function(e){return e.toUpperCase()}},a:{regExp:/[A-Za-z]/,transform:function(e){return e.toLowerCase()}},U:{regExp:/[A-Z]/},l:{regExp:/[a-z]/},9:{regExp:/[0-9]/}}}])});
{
"name": "redux-form-input-masks",
"version": "1.1.2",
"version": "1.1.3",
"description": "Input masking with redux-form made easy",

@@ -5,0 +5,0 @@ "main": "./dist/bundle.js",

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