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.5 to 1.2.0

13

CHANGELOG.md

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

<a name="1.2.0"></a>
# [1.2.0](https://github.com/renato-bohler/redux-form-input-masks/compare/v1.1.5...v1.2.0) (2018-07-23)
### Bug Fixes
* **createNumberMask:** adds validation for the multiplier option ([dcca4a1](https://github.com/renato-bohler/redux-form-input-masks/commit/dcca4a1))
### Features
* **createNumberMask:** adds multiplier option ([8e4ea2b](https://github.com/renato-bohler/redux-form-input-masks/commit/8e4ea2b)), closes [#46](https://github.com/renato-bohler/redux-form-input-masks/issues/46)
<a name="1.1.5"></a>

@@ -2,0 +15,0 @@ ## [1.1.5](https://github.com/renato-bohler/redux-form-input-masks/compare/v1.1.4...v1.1.5) (2018-06-26)

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 o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.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,"\\$&")},o=function(e,t){return(e.match(t)||[]).length},a=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 o="",a=e||"",u=0;u<a.length;u+=1){var c=a.charAt(u),f=t.charAt(u),s=i(f,n);s&&(s.regExp.test(c)?o=o.concat(c):c===r&&(a=""))}return o},c=function(e,t,r,n,o){for(var a="",u=e||"",c=0,f=0;f<t.length;f+=1){var s=u.charAt(c),l=t.charAt(f),p=i(l,o);if(p)if(s)if(p.regExp.test(s))a=a.concat(s),c+=1;else{if(!n)return a;a=a.concat(r),u=""}else{if(!n)return a;a=a.concat(r)}else a=a.concat(l)}return a},f=function(e,t,r,o,a){for(var u=e||"",f=0;f<t.length;f+=1){var s=t.charAt(f);if(!i(s,a)){var l=n(s);u=u.replace(new RegExp(l),"")}}var p=n(r);return u=u.replace(p,""),c(u,t,r,o,a)},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 o=e.charAt(n),a=t.charAt(n),u=i(a,r);if(u){if(!u.regExp.test(o))return!1}else if(o!==a)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 o=e.charAt(n-1),a=e.charAt(n);(i(o,t)||i(a,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 o=0;o<e.length;o+=1){var a=e.charAt(o),u=t.charAt(o);if(a===r&&a!==u)return o}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 o=e||"",a=t||"",u="",c=0;c<o.length;c+=1){var f=o.charAt(c);if(f!==a.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 o=r[n];if(t[o].regExp.test(e))return o}};t.applyMask=c,t.applyTransform=v,t.countOcurrences=o,t.escapeRegExp=n,t.firstUnfilledPosition=p,t.getMaskDefinition=i,t.inputReformat=f,t.isPatternComplete=s,t.maskStrip=u,t.numberToLocaleString=a,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 o=r(3),a=n(o),i=r(4),u=n(i);t.createNumberMask=a.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,o=void 0===r?"":r,a=t.suffix,i=void 0===a?"":a,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+o+t+i},w=function(e,t){var r=(0,n.escapeRegExp)(o),a=(0,n.escapeRegExp)(i),u=new RegExp("^[-|+]? ?"+r),f=new RegExp(a+"$"),l=1;if(h){var v=/-/g,g=(0,n.countOcurrences)(e,v)-(0,n.countOcurrences)(o,v)-(0,n.countOcurrences)(i,v);l=Math.pow(-1,g)%2}var d=e;if(o&&(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){var t=e.target,r=e.type;"click"!==r&&"mousedown"!==r&&t&&(e.persist&&e.persist(),setTimeout(function(){var r=t.value.length-i.length;e.target.setSelectionRange(r,r)}))};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),o=r(5),a=function(e){return e&&e.__esModule?e:{default:e}}(o);t.default=function(e){var t=e.pattern,r=e.placeholder,o=void 0===r?"_":r,i=e.maskDefinitions,u=void 0===i?a.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(!o||1!==o.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)(o,u);if(g)throw new Error("The placeholder `"+o+"` matches the mask definition`"+g+"`. The mask created using `createTextMask`is therefore invalid.");var d=(0,n.maskStrip)(t,t,o,u),m=function(e){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return e?l||r?(0,n.applyMask)(e,t,o,f,u):e:(0,n.applyMask)("",t,o,f,u)},x=function(e,r){var a=(0,n.inputReformat)(e,t,o,f,u),i=(0,n.maskStrip)(a,t,o,u),c=(0,n.applyTransform)(i,l?r:(0,n.maskStrip)(r,t,o,u),d,u),s=m(c,!0),h=l?c:s,g=h!==r&&(""!==h||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,o,u);e.setSelectionRange(r,r)},y=function(e,t,r){for(var n=void 0,o=0;o<=h.length;o+=1){if(h[o]>t){n=o;break}}var a=void 0;if(void 0===(a="left"===r?h[n-1]:h[n])){var i="left"===r?0:h.length-1;a=h[i]}e.setSelectionRange(a,a)},b=function(e){if(e.target){e.persist&&e.persist();var r=e.target.selectionStart,n=e.target.value;setTimeout(function(){var o=e.target,a=e.type,i=e.key,u=e.target,c=u.value,f=u.selectionStart,s=u.selectionEnd;switch(a){case"change":if(c.length===n.length+1&&c.charAt(r)===t.charAt(r)){y(o,r,"left");break}k(o);break;case"focus":k(o);break;case"click":f===s&&(h.indexOf(f)>=0?e.preventDefault():k(o));break;case"keydown":"ArrowLeft"===i?y(o,f,"left"):"ArrowRight"===i&&y(o,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 o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.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,"\\$&")},o=function(e,t){return(e.match(t)||[]).length},a=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 o="",a=e||"",u=0;u<a.length;u+=1){var c=a.charAt(u),f=t.charAt(u),s=i(f,n);s&&(s.regExp.test(c)?o=o.concat(c):c===r&&(a=""))}return o},c=function(e,t,r,n,o){for(var a="",u=e||"",c=0,f=0;f<t.length;f+=1){var s=u.charAt(c),l=t.charAt(f),p=i(l,o);if(p)if(s)if(p.regExp.test(s))a=a.concat(s),c+=1;else{if(!n)return a;a=a.concat(r),u=""}else{if(!n)return a;a=a.concat(r)}else a=a.concat(l)}return a},f=function(e,t,r,o,a){for(var u=e||"",f=0;f<t.length;f+=1){var s=t.charAt(f);if(!i(s,a)){var l=n(s);u=u.replace(new RegExp(l),"")}}var p=n(r);return u=u.replace(p,""),c(u,t,r,o,a)},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 o=e.charAt(n),a=t.charAt(n),u=i(a,r);if(u){if(!u.regExp.test(o))return!1}else if(o!==a)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 o=e.charAt(n-1),a=e.charAt(n);(i(o,t)||i(a,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 o=0;o<e.length;o+=1){var a=e.charAt(o),u=t.charAt(o);if(a===r&&a!==u)return o}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},h=function(e,t,r,n){for(var o=e||"",a=t||"",u="",c=0;c<o.length;c+=1){var f=o.charAt(c);if(f!==a.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},v=function(e,t){for(var r=Object.keys(t),n=0;n<r.length;n+=1){var o=r[n];if(t[o].regExp.test(e))return o}};t.applyMask=c,t.applyTransform=h,t.countOcurrences=o,t.escapeRegExp=n,t.firstUnfilledPosition=p,t.getMaskDefinition=i,t.inputReformat=f,t.isPatternComplete=s,t.maskStrip=u,t.numberToLocaleString=a,t.charMatchTest=v,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 o=r(3),a=n(o),i=r(4),u=n(i);t.createNumberMask=a.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,o=void 0===r?"":r,a=t.suffix,i=void 0===a?"":a,u=t.decimalPlaces,c=void 0===u?0:u,f=t.multiplier,s=void 0===f?1:f,l=t.stringValue,p=void 0!==l&&l,h=t.allowEmpty,v=void 0!==h&&h,g=t.allowNegative,d=void 0!==g&&g,m=t.showPlusSign,b=void 0!==m&&m,x=t.spaceAfterSign,k=void 0!==x&&x,y=t.locale,w=t.onChange;if(c>10)throw new Error("The maximum value for createNumberMask's option `decimalPlaces` is 10.");if("number"!=typeof s)throw new Error("The createNumberMask's option `multilpier` should be of type number.");if(0===s)throw new Error("The createNumberMask's option `multilpier` cannot be zero.");var M=function(e){var t=e;if(void 0===t||""===t){if(v)return"";t=0}else"number"!=typeof t&&(t=Number(t));var r=b?"+":"";return t<0&&(t*=-1,d&&(r="-")),r&&k&&(r+=" "),t*=1/s,t=(0,n.numberToLocaleString)(t,y,c),""+r+o+t+i},A=function(e,t){var r=(0,n.escapeRegExp)(o),a=(0,n.escapeRegExp)(i),u=new RegExp("^[-|+]? ?"+r),f=new RegExp(a+"$"),l=1;if(d){var h=/-/g,g=(0,n.countOcurrences)(e,h)-(0,n.countOcurrences)(o,h)-(0,n.countOcurrences)(i,h);l=Math.pow(-1,g)%2}var m=e;if(o&&(m=m.replace(u,"")),i&&(m=m.replace(f,"")),m=m.replace(/\D/g,""),v){var b=""===m,x=""===m.replace(/0+/g,""),k=m.length<=c,y=void 0===t;if(b||!y&&k&&x)return""}var M=Number(m)/Math.pow(10,c)*l;M=Number((M*s).toPrecision(10)),p&&(M=M.toString());var A=M!==t;return w&&A&&w(M),M},E=function(e){var t=e.target;t&&(e.persist&&e.persist(),setTimeout(function(){var r=t.value.length-i.length;e.target.setSelectionRange(r,r)}))};return{format:function(e){return M(e)},normalize:function(e,t){return A(e,t)},onChange:function(e){return E(e)},onFocus:function(e){return E(e)},autoComplete:"off"}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=r(5),a=function(e){return e&&e.__esModule?e:{default:e}}(o);t.default=function(e){var t=e.pattern,r=e.placeholder,o=void 0===r?"_":r,i=e.maskDefinitions,u=void 0===i?a.default:i,c=e.guide,f=void 0===c||c,s=e.stripMask,l=void 0===s||s,p=e.onChange,h=e.onCompletePattern;if(!t)throw new Error("The key `pattern` is required for createTextMask. You probably forgot to add it to your options.");if(!o||1!==o.length)throw new Error("The key `placeholder` should have a single character as a value.");var v=(0,n.validCaretPositions)(t,u);if(0===v.length)throw new Error("The pattern `"+t+"` passed for createTextMask is not valid.");var g=(0,n.charMatchTest)(o,u);if(g)throw new Error("The placeholder `"+o+"` matches the mask definition`"+g+"`. The mask created using `createTextMask`is therefore invalid.");var d=(0,n.maskStrip)(t,t,o,u),m=function(e){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return e?l||r?(0,n.applyMask)(e,t,o,f,u):e:(0,n.applyMask)("",t,o,f,u)},b=function(e,r){var a=(0,n.inputReformat)(e,t,o,f,u),i=(0,n.maskStrip)(a,t,o,u),c=(0,n.applyTransform)(i,l?r:(0,n.maskStrip)(r,t,o,u),d,u),s=m(c,!0),v=l?c:s,g=v!==r&&(""!==v||void 0!==r);return p&&g&&p(v),h&&(0,n.isPatternComplete)(s,t,u)&&g&&setTimeout(function(){return h(v)},10),v},x=function(e){var r=(0,n.firstUnfilledPosition)(e.value,t,o,u);e.setSelectionRange(r,r)},k=function(e,t,r){for(var n=void 0,o=0;o<=v.length;o+=1){if(v[o]>t){n=o;break}}var a=void 0;if(void 0===(a="left"===r?v[n-1]:v[n])){var i="left"===r?0:v.length-1;a=v[i]}e.setSelectionRange(a,a)},y=function(e){if(e.target){e.persist&&e.persist();var r=e.target.selectionStart,n=e.target.value;setTimeout(function(){var o=e.target,a=e.type,i=e.key,u=e.target,c=u.value,f=u.selectionStart,s=u.selectionEnd;switch(a){case"change":if(c.length===n.length+1&&c.charAt(r)===t.charAt(r)){k(o,r,"left");break}x(o);break;case"focus":x(o);break;case"click":f===s&&(v.indexOf(f)>=0?e.preventDefault():x(o));break;case"keydown":"ArrowLeft"===i?k(o,f,"left"):"ArrowRight"===i&&k(o,r,"right")}})}};return{format:function(e){return m(e)},normalize:function(e,t){return b(e,t)},onKeyDown:function(e){return y(e)},onChange:function(e){return y(e)},onFocus:function(e){return y(e)},onClick:function(e){return y(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.5",
"version": "1.2.0",
"description": "Input masking with redux-form made easy",

@@ -57,3 +57,3 @@ "main": "./dist/bundle.js",

"cz-conventional-changelog": "^2.1.0",
"danger": "^3.1.7",
"danger": "2.0.3",
"eslint": "^4.18.0",

@@ -60,0 +60,0 @@ "eslint-config-airbnb-base": "^12.1.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