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

text-mask-addons

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

text-mask-addons - npm Package Compare versions

Comparing version 0.6.0 to 0.7.0

dist/autoCorrectedMmddyyyyPipe.d.ts

2

dist/stats.json

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

{"errors":[],"warnings":[],"version":"1.13.1","hash":"6139c14316a2f95ff151","publicPath":"","assetsByChunkName":{"emailMask":"emailMask.js","createNumberMask":"createNumberMask.js","autoCorrectedMmddyyyyPipe":"autoCorrectedMmddyyyyPipe.js"},"assets":[{"name":"emailMask.js","size":2148,"chunks":[0],"chunkNames":["emailMask"],"emitted":true},{"name":"createNumberMask.js","size":1843,"chunks":[1],"chunkNames":["createNumberMask"],"emitted":true},{"name":"autoCorrectedMmddyyyyPipe.js","size":1027,"chunks":[2],"chunkNames":["autoCorrectedMmddyyyyPipe"],"emitted":true},{"name":"stats.json","size":0,"chunks":[],"chunkNames":[]}],"chunks":[{"id":0,"rendered":true,"initial":true,"entry":true,"extraAsync":false,"size":5422,"names":["emailMask"],"files":["emailMask.js"],"hash":"ceb9b13e9e1f101cc316","parents":[],"modules":[{"id":0,"identifier":"/Users/mk/Code/github/msafi/text-mask/node_modules/babel-loader/index.js!/Users/mk/Code/github/msafi/text-mask/addons/src/emailMask.js","name":"./addons/src/emailMask.js","index":2,"index2":3,"size":3851,"cacheable":true,"built":true,"optional":false,"prefetched":false,"chunks":[0],"assets":[],"issuer":null,"failed":false,"errors":0,"warnings":0,"reasons":[],"source":"'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _emailPipe = require('./emailPipe.js');\n\nvar _emailPipe2 = _interopRequireDefault(_emailPipe);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar asterisk = '*';\nvar dot = '.';\nvar emptyString = '';\nvar atSymbol = '@';\nvar caretTrap = '[]';\nvar space = ' ';\nvar g = 'g';\nvar anyNonWhitespaceRegExp = /[^\\s]/;\nvar anyNonDotOrWhitespaceRegExp = /[^.\\s]/;\nvar allWhitespaceRegExp = /\\s/g;\n\nfunction emailMask(rawValue, config) {\n rawValue = rawValue.replace(allWhitespaceRegExp, emptyString);\n\n var placeholderChar = config.placeholderChar;\n var currentCaretPosition = config.currentCaretPosition;\n\n var indexOfFirstAtSymbol = rawValue.indexOf(atSymbol);\n var indexOfLastDot = rawValue.lastIndexOf(dot);\n var indexOfTopLevelDomainDot = indexOfLastDot < indexOfFirstAtSymbol ? -1 : indexOfLastDot;\n\n var localPartToDomainConnector = getConnector(rawValue, indexOfFirstAtSymbol + 1, atSymbol);\n var domainNameToTopLevelDomainConnector = getConnector(rawValue, indexOfTopLevelDomainDot - 1, dot);\n\n var localPart = getLocalPart(rawValue, indexOfFirstAtSymbol, placeholderChar);\n var domainName = getDomainName(rawValue, indexOfFirstAtSymbol, indexOfTopLevelDomainDot, placeholderChar);\n var topLevelDomain = getTopLevelDomain(rawValue, indexOfTopLevelDomainDot, placeholderChar, currentCaretPosition);\n\n localPart = convertToMask(localPart);\n domainName = convertToMask(domainName);\n topLevelDomain = convertToMask(topLevelDomain, true);\n\n var mask = localPart.concat(localPartToDomainConnector).concat(domainName).concat(domainNameToTopLevelDomainConnector).concat(topLevelDomain);\n\n return mask;\n}\n\nfunction getConnector(rawValue, indexOfConnection, connectionSymbol) {\n var connector = [];\n\n if (rawValue[indexOfConnection] === connectionSymbol) {\n connector.push(connectionSymbol);\n } else {\n connector.push(caretTrap, connectionSymbol);\n }\n\n connector.push(caretTrap);\n\n return connector;\n}\n\nfunction getLocalPart(rawValue, indexOfFirstAtSymbol) {\n if (indexOfFirstAtSymbol === -1) {\n return rawValue;\n } else {\n return rawValue.slice(0, indexOfFirstAtSymbol);\n }\n}\n\nfunction getDomainName(rawValue, indexOfFirstAtSymbol, indexOfTopLevelDomainDot, placeholderChar) {\n var domainName = emptyString;\n\n if (indexOfFirstAtSymbol !== -1) {\n if (indexOfTopLevelDomainDot === -1) {\n domainName = rawValue.slice(indexOfFirstAtSymbol + 1, rawValue.length);\n } else {\n domainName = rawValue.slice(indexOfFirstAtSymbol + 1, indexOfTopLevelDomainDot);\n }\n }\n\n domainName = domainName.replace(new RegExp('[\\\\s' + placeholderChar + ']', g), emptyString);\n\n if (domainName === atSymbol) {\n return asterisk;\n } else if (domainName.length < 1) {\n return space;\n } else if (domainName[domainName.length - 1] === dot) {\n return domainName.slice(0, domainName.length - 1);\n } else {\n return domainName;\n }\n}\n\nfunction getTopLevelDomain(rawValue, indexOfTopLevelDomainDot, placeholderChar, currentCaretPosition) {\n var topLevelDomain = emptyString;\n\n if (indexOfTopLevelDomainDot !== -1) {\n topLevelDomain = rawValue.slice(indexOfTopLevelDomainDot + 1, rawValue.length);\n }\n\n topLevelDomain = topLevelDomain.replace(new RegExp('[\\\\s' + placeholderChar + '.]', g), emptyString);\n\n if (topLevelDomain.length === 0) {\n return rawValue[indexOfTopLevelDomainDot - 1] === dot && currentCaretPosition !== rawValue.length ? asterisk : emptyString;\n } else {\n return topLevelDomain;\n }\n}\n\nfunction convertToMask(str, noDots) {\n return str.split(emptyString).map(function (char) {\n return char === space ? char : noDots ? anyNonDotOrWhitespaceRegExp : anyNonWhitespaceRegExp;\n });\n}\n\nexports.default = { mask: emailMask, pipe: _emailPipe2.default };"},{"id":1,"identifier":"/Users/mk/Code/github/msafi/text-mask/node_modules/babel-loader/index.js!/Users/mk/Code/github/msafi/text-mask/addons/src/emailPipe.js","name":"./addons/src/emailPipe.js","index":3,"index2":2,"size":1571,"cacheable":true,"built":true,"optional":false,"prefetched":false,"chunks":[0],"assets":[],"issuer":"/Users/mk/Code/github/msafi/text-mask/node_modules/babel-loader/index.js!/Users/mk/Code/github/msafi/text-mask/addons/src/emailMask.js","failed":false,"errors":0,"warnings":0,"reasons":[{"moduleId":0,"moduleIdentifier":"/Users/mk/Code/github/msafi/text-mask/node_modules/babel-loader/index.js!/Users/mk/Code/github/msafi/text-mask/addons/src/emailMask.js","module":"./addons/src/emailMask.js","moduleName":"./addons/src/emailMask.js","type":"cjs require","userRequest":"./emailPipe.js","loc":"7:17-42"}],"source":"'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = emailPipe;\nvar atSymbol = '@';\nvar allAtSymbolsRegExp = /@/g;\nvar emptyString = '';\nvar atDot = '@.';\nvar dot = '.';\nvar dotDot = '..';\nvar emptyArray = [];\nvar allDotsRegExp = /\\./g;\n\nfunction emailPipe(conformedValue, config) {\n var currentCaretPosition = config.currentCaretPosition;\n var rawValue = config.rawValue;\n var previousConformedValue = config.previousConformedValue;\n var placeholderChar = config.placeholderChar;\n\n\n var value = conformedValue;\n\n value = removeAllAtSymbolsButFirst(value);\n\n var indexOfAtDot = value.indexOf(atDot);\n\n var emptyEmail = rawValue.match(new RegExp('[^@\\\\s.' + placeholderChar + ']')) === null;\n\n if (emptyEmail) {\n return emptyString;\n }\n\n if (value.indexOf(dotDot) !== -1 || indexOfAtDot !== -1 && currentCaretPosition !== indexOfAtDot + 1 || rawValue.indexOf(atSymbol) === -1 && previousConformedValue !== emptyString && rawValue.indexOf(dot) !== -1) {\n return false;\n }\n\n var indexOfAtSymbol = value.indexOf(atSymbol);\n var domainPart = value.slice(indexOfAtSymbol + 1, value.length);\n\n if ((domainPart.match(allDotsRegExp) || emptyArray).length > 1 && value.substr(-1) === dot && currentCaretPosition !== rawValue.length) {\n value = value.slice(0, value.length - 1);\n }\n\n return value;\n}\n\nfunction removeAllAtSymbolsButFirst(str) {\n var atSymbolCount = 0;\n\n return str.replace(allAtSymbolsRegExp, function () {\n atSymbolCount++;\n\n return atSymbolCount === 1 ? atSymbol : emptyString;\n });\n}"}],"filteredModules":0,"origins":[{"moduleId":0,"module":"/Users/mk/Code/github/msafi/text-mask/node_modules/babel-loader/index.js!/Users/mk/Code/github/msafi/text-mask/addons/src/emailMask.js","moduleIdentifier":"/Users/mk/Code/github/msafi/text-mask/node_modules/babel-loader/index.js!/Users/mk/Code/github/msafi/text-mask/addons/src/emailMask.js","moduleName":"./addons/src/emailMask.js","loc":"","name":"emailMask","reasons":[]}]},{"id":1,"rendered":true,"initial":true,"entry":true,"extraAsync":false,"size":3863,"names":["createNumberMask"],"files":["createNumberMask.js"],"hash":"98a081d374d4c228526d","parents":[],"modules":[{"id":0,"identifier":"/Users/mk/Code/github/msafi/text-mask/node_modules/babel-loader/index.js!/Users/mk/Code/github/msafi/text-mask/addons/src/createNumberMask.js","name":"./addons/src/createNumberMask.js","index":1,"index2":1,"size":3863,"cacheable":true,"built":true,"optional":false,"prefetched":false,"chunks":[1],"assets":[],"issuer":null,"failed":false,"errors":0,"warnings":0,"reasons":[],"source":"'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol ? \"symbol\" : typeof obj; };\n\nexports.default = createNumberMask;\nvar dollarSign = '$';\nvar emptyString = '';\nvar comma = ',';\nvar period = '.';\nvar nonDigitsRegExp = /\\D+/g;\nvar number = 'number';\nvar digitRegExp = /\\d/;\n\nfunction createNumberMask() {\n var _ref = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];\n\n var _ref$prefix = _ref.prefix;\n var prefix = _ref$prefix === undefined ? dollarSign : _ref$prefix;\n var _ref$suffix = _ref.suffix;\n var suffix = _ref$suffix === undefined ? emptyString : _ref$suffix;\n var _ref$includeThousands = _ref.includeThousandsSeparator;\n var includeThousandsSeparator = _ref$includeThousands === undefined ? true : _ref$includeThousands;\n var _ref$thousandsSeparat = _ref.thousandsSeparatorSymbol;\n var thousandsSeparatorSymbol = _ref$thousandsSeparat === undefined ? comma : _ref$thousandsSeparat;\n var _ref$allowDecimal = _ref.allowDecimal;\n var allowDecimal = _ref$allowDecimal === undefined ? false : _ref$allowDecimal;\n var _ref$decimalSymbol = _ref.decimalSymbol;\n var decimalSymbol = _ref$decimalSymbol === undefined ? period : _ref$decimalSymbol;\n var _ref$decimalLimit = _ref.decimalLimit;\n var decimalLimit = _ref$decimalLimit === undefined ? 2 : _ref$decimalLimit;\n var _ref$requireDecimal = _ref.requireDecimal;\n var requireDecimal = _ref$requireDecimal === undefined ? false : _ref$requireDecimal;\n\n function numberMask(rawValue) {\n var rawValueLength = rawValue.length;\n\n if (rawValue === emptyString || rawValue[0] === prefix[0] && rawValueLength === 1) {\n return prefix.split(emptyString).concat([digitRegExp]).concat(suffix.split(emptyString));\n }\n\n var indexOfLastDecimal = rawValue.lastIndexOf(decimalSymbol);\n var hasDecimal = indexOfLastDecimal !== -1;\n\n var integer = void 0;\n var fraction = void 0;\n var mask = void 0;\n\n if (hasDecimal && (allowDecimal || requireDecimal)) {\n integer = rawValue.slice(0, indexOfLastDecimal);\n\n fraction = rawValue.slice(indexOfLastDecimal + 1, rawValueLength);\n fraction = convertToMask(fraction.replace(nonDigitsRegExp, emptyString));\n } else {\n integer = rawValue;\n }\n\n integer = integer.replace(nonDigitsRegExp, emptyString);\n\n integer = includeThousandsSeparator ? addThousandsSeparator(integer, thousandsSeparatorSymbol) : integer;\n\n mask = convertToMask(integer);\n\n if (hasDecimal && allowDecimal || requireDecimal === true) {\n if (rawValue[indexOfLastDecimal - 1] !== decimalSymbol) {\n mask.push('[]');\n }\n\n mask.push(decimalSymbol, '[]');\n\n if (fraction) {\n if ((typeof decimalLimit === 'undefined' ? 'undefined' : _typeof(decimalLimit)) === number) {\n fraction = fraction.slice(0, decimalLimit);\n }\n\n mask = mask.concat(fraction);\n } else if (requireDecimal === true) {\n for (var i = 0; i < decimalLimit; i++) {\n mask.push(digitRegExp);\n }\n }\n }\n\n if (prefix.length > 0) {\n mask = prefix.split(emptyString).concat(mask);\n }\n\n if (suffix.length > 0) {\n mask = mask.concat(suffix.split(emptyString));\n }\n\n return mask;\n }\n\n numberMask.instanceOf = 'createNumberMask';\n\n return numberMask;\n}\n\nfunction convertToMask(strNumber) {\n return strNumber.split(emptyString).map(function (char) {\n return digitRegExp.test(char) ? digitRegExp : char;\n });\n}\n\n// http://stackoverflow.com/a/10899795/604296\nfunction addThousandsSeparator(n, thousandsSeparatorSymbol) {\n return n.replace(/\\B(?=(\\d{3})+(?!\\d))/g, thousandsSeparatorSymbol);\n}"}],"filteredModules":0,"origins":[{"moduleId":0,"module":"/Users/mk/Code/github/msafi/text-mask/node_modules/babel-loader/index.js!/Users/mk/Code/github/msafi/text-mask/addons/src/createNumberMask.js","moduleIdentifier":"/Users/mk/Code/github/msafi/text-mask/node_modules/babel-loader/index.js!/Users/mk/Code/github/msafi/text-mask/addons/src/createNumberMask.js","moduleName":"./addons/src/createNumberMask.js","loc":"","name":"createNumberMask","reasons":[]}]},{"id":2,"rendered":true,"initial":true,"entry":true,"extraAsync":false,"size":1597,"names":["autoCorrectedMmddyyyyPipe"],"files":["autoCorrectedMmddyyyyPipe.js"],"hash":"9057681677456b4c37ef","parents":[],"modules":[{"id":0,"identifier":"/Users/mk/Code/github/msafi/text-mask/node_modules/babel-loader/index.js!/Users/mk/Code/github/msafi/text-mask/addons/src/autoCorrectedMmddyyyyPipe.js","name":"./addons/src/autoCorrectedMmddyyyyPipe.js","index":0,"index2":0,"size":1597,"cacheable":true,"built":true,"optional":false,"prefetched":false,"chunks":[2],"assets":[],"issuer":null,"failed":false,"errors":0,"warnings":0,"reasons":[],"source":"'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = autoCorrectedMmddyyyyPipe;\nfunction autoCorrectedMmddyyyyPipe(conformedValue) {\n var conformedValueArr = conformedValue.split('');\n var indexesOfPipedChars = [];\n\n var month1stDigit = parseDigit(conformedValue[0]);\n var month2ndDigit = parseDigit(conformedValue[1]);\n var day1stDigit = parseDigit(conformedValue[3]);\n var day2ndDigit = parseDigit(conformedValue[4]);\n var year1stDigit = parseDigit(conformedValue[6]);\n\n if (month1stDigit > 1) {\n conformedValueArr.splice(0, 2, 0, month1stDigit);\n\n indexesOfPipedChars.push(0);\n }\n\n if (month1stDigit === 1 && month2ndDigit > 2 || month1stDigit === 0 && month2ndDigit === 0) {\n return false;\n }\n\n if (day1stDigit > 3) {\n conformedValueArr.splice(3, 2, 0, day1stDigit);\n\n indexesOfPipedChars.push(3);\n }\n\n if (day1stDigit === 3 && day2ndDigit > 1 || day1stDigit === 0 && day2ndDigit === 0) {\n return false;\n }\n\n if (year1stDigit === 0) {\n conformedValueArr.splice(6, 3, 2, 0, year1stDigit);\n\n indexesOfPipedChars.push(6, 7);\n }\n\n return {\n value: conformedValueArr.join(''),\n indexesOfPipedChars: indexesOfPipedChars\n };\n}\n\nvar digitsNumbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];\nvar digitsStrings = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];\nvar allDigits = digitsNumbers.concat(digitsStrings);\nfunction parseDigit(value) {\n var digit = allDigits.find(function (digit) {\n return digit === value;\n });\n\n if (digit === undefined) {\n return value;\n } else {\n return Number(digit);\n }\n}"}],"filteredModules":0,"origins":[{"moduleId":0,"module":"/Users/mk/Code/github/msafi/text-mask/node_modules/babel-loader/index.js!/Users/mk/Code/github/msafi/text-mask/addons/src/autoCorrectedMmddyyyyPipe.js","moduleIdentifier":"/Users/mk/Code/github/msafi/text-mask/node_modules/babel-loader/index.js!/Users/mk/Code/github/msafi/text-mask/addons/src/autoCorrectedMmddyyyyPipe.js","moduleName":"./addons/src/autoCorrectedMmddyyyyPipe.js","loc":"","name":"autoCorrectedMmddyyyyPipe","reasons":[]}]}],"modules":[{"id":0,"identifier":"/Users/mk/Code/github/msafi/text-mask/node_modules/babel-loader/index.js!/Users/mk/Code/github/msafi/text-mask/addons/src/autoCorrectedMmddyyyyPipe.js","name":"./addons/src/autoCorrectedMmddyyyyPipe.js","index":0,"index2":0,"size":1597,"cacheable":true,"built":true,"optional":false,"prefetched":false,"chunks":[2],"assets":[],"issuer":null,"failed":false,"errors":0,"warnings":0,"reasons":[],"source":"'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = autoCorrectedMmddyyyyPipe;\nfunction autoCorrectedMmddyyyyPipe(conformedValue) {\n var conformedValueArr = conformedValue.split('');\n var indexesOfPipedChars = [];\n\n var month1stDigit = parseDigit(conformedValue[0]);\n var month2ndDigit = parseDigit(conformedValue[1]);\n var day1stDigit = parseDigit(conformedValue[3]);\n var day2ndDigit = parseDigit(conformedValue[4]);\n var year1stDigit = parseDigit(conformedValue[6]);\n\n if (month1stDigit > 1) {\n conformedValueArr.splice(0, 2, 0, month1stDigit);\n\n indexesOfPipedChars.push(0);\n }\n\n if (month1stDigit === 1 && month2ndDigit > 2 || month1stDigit === 0 && month2ndDigit === 0) {\n return false;\n }\n\n if (day1stDigit > 3) {\n conformedValueArr.splice(3, 2, 0, day1stDigit);\n\n indexesOfPipedChars.push(3);\n }\n\n if (day1stDigit === 3 && day2ndDigit > 1 || day1stDigit === 0 && day2ndDigit === 0) {\n return false;\n }\n\n if (year1stDigit === 0) {\n conformedValueArr.splice(6, 3, 2, 0, year1stDigit);\n\n indexesOfPipedChars.push(6, 7);\n }\n\n return {\n value: conformedValueArr.join(''),\n indexesOfPipedChars: indexesOfPipedChars\n };\n}\n\nvar digitsNumbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];\nvar digitsStrings = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];\nvar allDigits = digitsNumbers.concat(digitsStrings);\nfunction parseDigit(value) {\n var digit = allDigits.find(function (digit) {\n return digit === value;\n });\n\n if (digit === undefined) {\n return value;\n } else {\n return Number(digit);\n }\n}"},{"id":0,"identifier":"/Users/mk/Code/github/msafi/text-mask/node_modules/babel-loader/index.js!/Users/mk/Code/github/msafi/text-mask/addons/src/createNumberMask.js","name":"./addons/src/createNumberMask.js","index":1,"index2":1,"size":3863,"cacheable":true,"built":true,"optional":false,"prefetched":false,"chunks":[1],"assets":[],"issuer":null,"failed":false,"errors":0,"warnings":0,"reasons":[],"source":"'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol ? \"symbol\" : typeof obj; };\n\nexports.default = createNumberMask;\nvar dollarSign = '$';\nvar emptyString = '';\nvar comma = ',';\nvar period = '.';\nvar nonDigitsRegExp = /\\D+/g;\nvar number = 'number';\nvar digitRegExp = /\\d/;\n\nfunction createNumberMask() {\n var _ref = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];\n\n var _ref$prefix = _ref.prefix;\n var prefix = _ref$prefix === undefined ? dollarSign : _ref$prefix;\n var _ref$suffix = _ref.suffix;\n var suffix = _ref$suffix === undefined ? emptyString : _ref$suffix;\n var _ref$includeThousands = _ref.includeThousandsSeparator;\n var includeThousandsSeparator = _ref$includeThousands === undefined ? true : _ref$includeThousands;\n var _ref$thousandsSeparat = _ref.thousandsSeparatorSymbol;\n var thousandsSeparatorSymbol = _ref$thousandsSeparat === undefined ? comma : _ref$thousandsSeparat;\n var _ref$allowDecimal = _ref.allowDecimal;\n var allowDecimal = _ref$allowDecimal === undefined ? false : _ref$allowDecimal;\n var _ref$decimalSymbol = _ref.decimalSymbol;\n var decimalSymbol = _ref$decimalSymbol === undefined ? period : _ref$decimalSymbol;\n var _ref$decimalLimit = _ref.decimalLimit;\n var decimalLimit = _ref$decimalLimit === undefined ? 2 : _ref$decimalLimit;\n var _ref$requireDecimal = _ref.requireDecimal;\n var requireDecimal = _ref$requireDecimal === undefined ? false : _ref$requireDecimal;\n\n function numberMask(rawValue) {\n var rawValueLength = rawValue.length;\n\n if (rawValue === emptyString || rawValue[0] === prefix[0] && rawValueLength === 1) {\n return prefix.split(emptyString).concat([digitRegExp]).concat(suffix.split(emptyString));\n }\n\n var indexOfLastDecimal = rawValue.lastIndexOf(decimalSymbol);\n var hasDecimal = indexOfLastDecimal !== -1;\n\n var integer = void 0;\n var fraction = void 0;\n var mask = void 0;\n\n if (hasDecimal && (allowDecimal || requireDecimal)) {\n integer = rawValue.slice(0, indexOfLastDecimal);\n\n fraction = rawValue.slice(indexOfLastDecimal + 1, rawValueLength);\n fraction = convertToMask(fraction.replace(nonDigitsRegExp, emptyString));\n } else {\n integer = rawValue;\n }\n\n integer = integer.replace(nonDigitsRegExp, emptyString);\n\n integer = includeThousandsSeparator ? addThousandsSeparator(integer, thousandsSeparatorSymbol) : integer;\n\n mask = convertToMask(integer);\n\n if (hasDecimal && allowDecimal || requireDecimal === true) {\n if (rawValue[indexOfLastDecimal - 1] !== decimalSymbol) {\n mask.push('[]');\n }\n\n mask.push(decimalSymbol, '[]');\n\n if (fraction) {\n if ((typeof decimalLimit === 'undefined' ? 'undefined' : _typeof(decimalLimit)) === number) {\n fraction = fraction.slice(0, decimalLimit);\n }\n\n mask = mask.concat(fraction);\n } else if (requireDecimal === true) {\n for (var i = 0; i < decimalLimit; i++) {\n mask.push(digitRegExp);\n }\n }\n }\n\n if (prefix.length > 0) {\n mask = prefix.split(emptyString).concat(mask);\n }\n\n if (suffix.length > 0) {\n mask = mask.concat(suffix.split(emptyString));\n }\n\n return mask;\n }\n\n numberMask.instanceOf = 'createNumberMask';\n\n return numberMask;\n}\n\nfunction convertToMask(strNumber) {\n return strNumber.split(emptyString).map(function (char) {\n return digitRegExp.test(char) ? digitRegExp : char;\n });\n}\n\n// http://stackoverflow.com/a/10899795/604296\nfunction addThousandsSeparator(n, thousandsSeparatorSymbol) {\n return n.replace(/\\B(?=(\\d{3})+(?!\\d))/g, thousandsSeparatorSymbol);\n}"},{"id":0,"identifier":"/Users/mk/Code/github/msafi/text-mask/node_modules/babel-loader/index.js!/Users/mk/Code/github/msafi/text-mask/addons/src/emailMask.js","name":"./addons/src/emailMask.js","index":2,"index2":3,"size":3851,"cacheable":true,"built":true,"optional":false,"prefetched":false,"chunks":[0],"assets":[],"issuer":null,"failed":false,"errors":0,"warnings":0,"reasons":[],"source":"'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _emailPipe = require('./emailPipe.js');\n\nvar _emailPipe2 = _interopRequireDefault(_emailPipe);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar asterisk = '*';\nvar dot = '.';\nvar emptyString = '';\nvar atSymbol = '@';\nvar caretTrap = '[]';\nvar space = ' ';\nvar g = 'g';\nvar anyNonWhitespaceRegExp = /[^\\s]/;\nvar anyNonDotOrWhitespaceRegExp = /[^.\\s]/;\nvar allWhitespaceRegExp = /\\s/g;\n\nfunction emailMask(rawValue, config) {\n rawValue = rawValue.replace(allWhitespaceRegExp, emptyString);\n\n var placeholderChar = config.placeholderChar;\n var currentCaretPosition = config.currentCaretPosition;\n\n var indexOfFirstAtSymbol = rawValue.indexOf(atSymbol);\n var indexOfLastDot = rawValue.lastIndexOf(dot);\n var indexOfTopLevelDomainDot = indexOfLastDot < indexOfFirstAtSymbol ? -1 : indexOfLastDot;\n\n var localPartToDomainConnector = getConnector(rawValue, indexOfFirstAtSymbol + 1, atSymbol);\n var domainNameToTopLevelDomainConnector = getConnector(rawValue, indexOfTopLevelDomainDot - 1, dot);\n\n var localPart = getLocalPart(rawValue, indexOfFirstAtSymbol, placeholderChar);\n var domainName = getDomainName(rawValue, indexOfFirstAtSymbol, indexOfTopLevelDomainDot, placeholderChar);\n var topLevelDomain = getTopLevelDomain(rawValue, indexOfTopLevelDomainDot, placeholderChar, currentCaretPosition);\n\n localPart = convertToMask(localPart);\n domainName = convertToMask(domainName);\n topLevelDomain = convertToMask(topLevelDomain, true);\n\n var mask = localPart.concat(localPartToDomainConnector).concat(domainName).concat(domainNameToTopLevelDomainConnector).concat(topLevelDomain);\n\n return mask;\n}\n\nfunction getConnector(rawValue, indexOfConnection, connectionSymbol) {\n var connector = [];\n\n if (rawValue[indexOfConnection] === connectionSymbol) {\n connector.push(connectionSymbol);\n } else {\n connector.push(caretTrap, connectionSymbol);\n }\n\n connector.push(caretTrap);\n\n return connector;\n}\n\nfunction getLocalPart(rawValue, indexOfFirstAtSymbol) {\n if (indexOfFirstAtSymbol === -1) {\n return rawValue;\n } else {\n return rawValue.slice(0, indexOfFirstAtSymbol);\n }\n}\n\nfunction getDomainName(rawValue, indexOfFirstAtSymbol, indexOfTopLevelDomainDot, placeholderChar) {\n var domainName = emptyString;\n\n if (indexOfFirstAtSymbol !== -1) {\n if (indexOfTopLevelDomainDot === -1) {\n domainName = rawValue.slice(indexOfFirstAtSymbol + 1, rawValue.length);\n } else {\n domainName = rawValue.slice(indexOfFirstAtSymbol + 1, indexOfTopLevelDomainDot);\n }\n }\n\n domainName = domainName.replace(new RegExp('[\\\\s' + placeholderChar + ']', g), emptyString);\n\n if (domainName === atSymbol) {\n return asterisk;\n } else if (domainName.length < 1) {\n return space;\n } else if (domainName[domainName.length - 1] === dot) {\n return domainName.slice(0, domainName.length - 1);\n } else {\n return domainName;\n }\n}\n\nfunction getTopLevelDomain(rawValue, indexOfTopLevelDomainDot, placeholderChar, currentCaretPosition) {\n var topLevelDomain = emptyString;\n\n if (indexOfTopLevelDomainDot !== -1) {\n topLevelDomain = rawValue.slice(indexOfTopLevelDomainDot + 1, rawValue.length);\n }\n\n topLevelDomain = topLevelDomain.replace(new RegExp('[\\\\s' + placeholderChar + '.]', g), emptyString);\n\n if (topLevelDomain.length === 0) {\n return rawValue[indexOfTopLevelDomainDot - 1] === dot && currentCaretPosition !== rawValue.length ? asterisk : emptyString;\n } else {\n return topLevelDomain;\n }\n}\n\nfunction convertToMask(str, noDots) {\n return str.split(emptyString).map(function (char) {\n return char === space ? char : noDots ? anyNonDotOrWhitespaceRegExp : anyNonWhitespaceRegExp;\n });\n}\n\nexports.default = { mask: emailMask, pipe: _emailPipe2.default };"},{"id":1,"identifier":"/Users/mk/Code/github/msafi/text-mask/node_modules/babel-loader/index.js!/Users/mk/Code/github/msafi/text-mask/addons/src/emailPipe.js","name":"./addons/src/emailPipe.js","index":3,"index2":2,"size":1571,"cacheable":true,"built":true,"optional":false,"prefetched":false,"chunks":[0],"assets":[],"issuer":"/Users/mk/Code/github/msafi/text-mask/node_modules/babel-loader/index.js!/Users/mk/Code/github/msafi/text-mask/addons/src/emailMask.js","failed":false,"errors":0,"warnings":0,"reasons":[{"moduleId":0,"moduleIdentifier":"/Users/mk/Code/github/msafi/text-mask/node_modules/babel-loader/index.js!/Users/mk/Code/github/msafi/text-mask/addons/src/emailMask.js","module":"./addons/src/emailMask.js","moduleName":"./addons/src/emailMask.js","type":"cjs require","userRequest":"./emailPipe.js","loc":"7:17-42"}],"source":"'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = emailPipe;\nvar atSymbol = '@';\nvar allAtSymbolsRegExp = /@/g;\nvar emptyString = '';\nvar atDot = '@.';\nvar dot = '.';\nvar dotDot = '..';\nvar emptyArray = [];\nvar allDotsRegExp = /\\./g;\n\nfunction emailPipe(conformedValue, config) {\n var currentCaretPosition = config.currentCaretPosition;\n var rawValue = config.rawValue;\n var previousConformedValue = config.previousConformedValue;\n var placeholderChar = config.placeholderChar;\n\n\n var value = conformedValue;\n\n value = removeAllAtSymbolsButFirst(value);\n\n var indexOfAtDot = value.indexOf(atDot);\n\n var emptyEmail = rawValue.match(new RegExp('[^@\\\\s.' + placeholderChar + ']')) === null;\n\n if (emptyEmail) {\n return emptyString;\n }\n\n if (value.indexOf(dotDot) !== -1 || indexOfAtDot !== -1 && currentCaretPosition !== indexOfAtDot + 1 || rawValue.indexOf(atSymbol) === -1 && previousConformedValue !== emptyString && rawValue.indexOf(dot) !== -1) {\n return false;\n }\n\n var indexOfAtSymbol = value.indexOf(atSymbol);\n var domainPart = value.slice(indexOfAtSymbol + 1, value.length);\n\n if ((domainPart.match(allDotsRegExp) || emptyArray).length > 1 && value.substr(-1) === dot && currentCaretPosition !== rawValue.length) {\n value = value.slice(0, value.length - 1);\n }\n\n return value;\n}\n\nfunction removeAllAtSymbolsButFirst(str) {\n var atSymbolCount = 0;\n\n return str.replace(allAtSymbolsRegExp, function () {\n atSymbolCount++;\n\n return atSymbolCount === 1 ? atSymbol : emptyString;\n });\n}"}],"filteredModules":0,"children":[]}
{"errors":[],"warnings":[],"version":"1.13.2","hash":"6139c14316a2f95ff151","publicPath":"","assetsByChunkName":{"emailMask":"emailMask.js","createNumberMask":"createNumberMask.js","autoCorrectedMmddyyyyPipe":"autoCorrectedMmddyyyyPipe.js"},"assets":[{"name":"emailMask.js","size":2148,"chunks":[0],"chunkNames":["emailMask"],"emitted":true},{"name":"createNumberMask.js","size":1843,"chunks":[1],"chunkNames":["createNumberMask"],"emitted":true},{"name":"autoCorrectedMmddyyyyPipe.js","size":1027,"chunks":[2],"chunkNames":["autoCorrectedMmddyyyyPipe"],"emitted":true},{"name":"stats.json","size":0,"chunks":[],"chunkNames":[]}],"chunks":[{"id":0,"rendered":true,"initial":true,"entry":true,"extraAsync":false,"size":5422,"names":["emailMask"],"files":["emailMask.js"],"hash":"ceb9b13e9e1f101cc316","parents":[],"modules":[{"id":0,"identifier":"/Users/mk/Code/github/msafi/text-mask/node_modules/babel-loader/index.js!/Users/mk/Code/github/msafi/text-mask/addons/src/emailMask.js","name":"./addons/src/emailMask.js","index":2,"index2":3,"size":3851,"cacheable":true,"built":true,"optional":false,"prefetched":false,"chunks":[0],"assets":[],"issuer":null,"failed":false,"errors":0,"warnings":0,"reasons":[],"source":"'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _emailPipe = require('./emailPipe.js');\n\nvar _emailPipe2 = _interopRequireDefault(_emailPipe);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar asterisk = '*';\nvar dot = '.';\nvar emptyString = '';\nvar atSymbol = '@';\nvar caretTrap = '[]';\nvar space = ' ';\nvar g = 'g';\nvar anyNonWhitespaceRegExp = /[^\\s]/;\nvar anyNonDotOrWhitespaceRegExp = /[^.\\s]/;\nvar allWhitespaceRegExp = /\\s/g;\n\nfunction emailMask(rawValue, config) {\n rawValue = rawValue.replace(allWhitespaceRegExp, emptyString);\n\n var placeholderChar = config.placeholderChar;\n var currentCaretPosition = config.currentCaretPosition;\n\n var indexOfFirstAtSymbol = rawValue.indexOf(atSymbol);\n var indexOfLastDot = rawValue.lastIndexOf(dot);\n var indexOfTopLevelDomainDot = indexOfLastDot < indexOfFirstAtSymbol ? -1 : indexOfLastDot;\n\n var localPartToDomainConnector = getConnector(rawValue, indexOfFirstAtSymbol + 1, atSymbol);\n var domainNameToTopLevelDomainConnector = getConnector(rawValue, indexOfTopLevelDomainDot - 1, dot);\n\n var localPart = getLocalPart(rawValue, indexOfFirstAtSymbol, placeholderChar);\n var domainName = getDomainName(rawValue, indexOfFirstAtSymbol, indexOfTopLevelDomainDot, placeholderChar);\n var topLevelDomain = getTopLevelDomain(rawValue, indexOfTopLevelDomainDot, placeholderChar, currentCaretPosition);\n\n localPart = convertToMask(localPart);\n domainName = convertToMask(domainName);\n topLevelDomain = convertToMask(topLevelDomain, true);\n\n var mask = localPart.concat(localPartToDomainConnector).concat(domainName).concat(domainNameToTopLevelDomainConnector).concat(topLevelDomain);\n\n return mask;\n}\n\nfunction getConnector(rawValue, indexOfConnection, connectionSymbol) {\n var connector = [];\n\n if (rawValue[indexOfConnection] === connectionSymbol) {\n connector.push(connectionSymbol);\n } else {\n connector.push(caretTrap, connectionSymbol);\n }\n\n connector.push(caretTrap);\n\n return connector;\n}\n\nfunction getLocalPart(rawValue, indexOfFirstAtSymbol) {\n if (indexOfFirstAtSymbol === -1) {\n return rawValue;\n } else {\n return rawValue.slice(0, indexOfFirstAtSymbol);\n }\n}\n\nfunction getDomainName(rawValue, indexOfFirstAtSymbol, indexOfTopLevelDomainDot, placeholderChar) {\n var domainName = emptyString;\n\n if (indexOfFirstAtSymbol !== -1) {\n if (indexOfTopLevelDomainDot === -1) {\n domainName = rawValue.slice(indexOfFirstAtSymbol + 1, rawValue.length);\n } else {\n domainName = rawValue.slice(indexOfFirstAtSymbol + 1, indexOfTopLevelDomainDot);\n }\n }\n\n domainName = domainName.replace(new RegExp('[\\\\s' + placeholderChar + ']', g), emptyString);\n\n if (domainName === atSymbol) {\n return asterisk;\n } else if (domainName.length < 1) {\n return space;\n } else if (domainName[domainName.length - 1] === dot) {\n return domainName.slice(0, domainName.length - 1);\n } else {\n return domainName;\n }\n}\n\nfunction getTopLevelDomain(rawValue, indexOfTopLevelDomainDot, placeholderChar, currentCaretPosition) {\n var topLevelDomain = emptyString;\n\n if (indexOfTopLevelDomainDot !== -1) {\n topLevelDomain = rawValue.slice(indexOfTopLevelDomainDot + 1, rawValue.length);\n }\n\n topLevelDomain = topLevelDomain.replace(new RegExp('[\\\\s' + placeholderChar + '.]', g), emptyString);\n\n if (topLevelDomain.length === 0) {\n return rawValue[indexOfTopLevelDomainDot - 1] === dot && currentCaretPosition !== rawValue.length ? asterisk : emptyString;\n } else {\n return topLevelDomain;\n }\n}\n\nfunction convertToMask(str, noDots) {\n return str.split(emptyString).map(function (char) {\n return char === space ? char : noDots ? anyNonDotOrWhitespaceRegExp : anyNonWhitespaceRegExp;\n });\n}\n\nexports.default = { mask: emailMask, pipe: _emailPipe2.default };"},{"id":1,"identifier":"/Users/mk/Code/github/msafi/text-mask/node_modules/babel-loader/index.js!/Users/mk/Code/github/msafi/text-mask/addons/src/emailPipe.js","name":"./addons/src/emailPipe.js","index":3,"index2":2,"size":1571,"cacheable":true,"built":true,"optional":false,"prefetched":false,"chunks":[0],"assets":[],"issuer":"/Users/mk/Code/github/msafi/text-mask/node_modules/babel-loader/index.js!/Users/mk/Code/github/msafi/text-mask/addons/src/emailMask.js","failed":false,"errors":0,"warnings":0,"reasons":[{"moduleId":0,"moduleIdentifier":"/Users/mk/Code/github/msafi/text-mask/node_modules/babel-loader/index.js!/Users/mk/Code/github/msafi/text-mask/addons/src/emailMask.js","module":"./addons/src/emailMask.js","moduleName":"./addons/src/emailMask.js","type":"cjs require","userRequest":"./emailPipe.js","loc":"7:17-42"}],"source":"'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = emailPipe;\nvar atSymbol = '@';\nvar allAtSymbolsRegExp = /@/g;\nvar emptyString = '';\nvar atDot = '@.';\nvar dot = '.';\nvar dotDot = '..';\nvar emptyArray = [];\nvar allDotsRegExp = /\\./g;\n\nfunction emailPipe(conformedValue, config) {\n var currentCaretPosition = config.currentCaretPosition;\n var rawValue = config.rawValue;\n var previousConformedValue = config.previousConformedValue;\n var placeholderChar = config.placeholderChar;\n\n\n var value = conformedValue;\n\n value = removeAllAtSymbolsButFirst(value);\n\n var indexOfAtDot = value.indexOf(atDot);\n\n var emptyEmail = rawValue.match(new RegExp('[^@\\\\s.' + placeholderChar + ']')) === null;\n\n if (emptyEmail) {\n return emptyString;\n }\n\n if (value.indexOf(dotDot) !== -1 || indexOfAtDot !== -1 && currentCaretPosition !== indexOfAtDot + 1 || rawValue.indexOf(atSymbol) === -1 && previousConformedValue !== emptyString && rawValue.indexOf(dot) !== -1) {\n return false;\n }\n\n var indexOfAtSymbol = value.indexOf(atSymbol);\n var domainPart = value.slice(indexOfAtSymbol + 1, value.length);\n\n if ((domainPart.match(allDotsRegExp) || emptyArray).length > 1 && value.substr(-1) === dot && currentCaretPosition !== rawValue.length) {\n value = value.slice(0, value.length - 1);\n }\n\n return value;\n}\n\nfunction removeAllAtSymbolsButFirst(str) {\n var atSymbolCount = 0;\n\n return str.replace(allAtSymbolsRegExp, function () {\n atSymbolCount++;\n\n return atSymbolCount === 1 ? atSymbol : emptyString;\n });\n}"}],"filteredModules":0,"origins":[{"moduleId":0,"module":"/Users/mk/Code/github/msafi/text-mask/node_modules/babel-loader/index.js!/Users/mk/Code/github/msafi/text-mask/addons/src/emailMask.js","moduleIdentifier":"/Users/mk/Code/github/msafi/text-mask/node_modules/babel-loader/index.js!/Users/mk/Code/github/msafi/text-mask/addons/src/emailMask.js","moduleName":"./addons/src/emailMask.js","loc":"","name":"emailMask","reasons":[]}]},{"id":1,"rendered":true,"initial":true,"entry":true,"extraAsync":false,"size":3863,"names":["createNumberMask"],"files":["createNumberMask.js"],"hash":"98a081d374d4c228526d","parents":[],"modules":[{"id":0,"identifier":"/Users/mk/Code/github/msafi/text-mask/node_modules/babel-loader/index.js!/Users/mk/Code/github/msafi/text-mask/addons/src/createNumberMask.js","name":"./addons/src/createNumberMask.js","index":1,"index2":1,"size":3863,"cacheable":true,"built":true,"optional":false,"prefetched":false,"chunks":[1],"assets":[],"issuer":null,"failed":false,"errors":0,"warnings":0,"reasons":[],"source":"'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol ? \"symbol\" : typeof obj; };\n\nexports.default = createNumberMask;\nvar dollarSign = '$';\nvar emptyString = '';\nvar comma = ',';\nvar period = '.';\nvar nonDigitsRegExp = /\\D+/g;\nvar number = 'number';\nvar digitRegExp = /\\d/;\n\nfunction createNumberMask() {\n var _ref = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];\n\n var _ref$prefix = _ref.prefix;\n var prefix = _ref$prefix === undefined ? dollarSign : _ref$prefix;\n var _ref$suffix = _ref.suffix;\n var suffix = _ref$suffix === undefined ? emptyString : _ref$suffix;\n var _ref$includeThousands = _ref.includeThousandsSeparator;\n var includeThousandsSeparator = _ref$includeThousands === undefined ? true : _ref$includeThousands;\n var _ref$thousandsSeparat = _ref.thousandsSeparatorSymbol;\n var thousandsSeparatorSymbol = _ref$thousandsSeparat === undefined ? comma : _ref$thousandsSeparat;\n var _ref$allowDecimal = _ref.allowDecimal;\n var allowDecimal = _ref$allowDecimal === undefined ? false : _ref$allowDecimal;\n var _ref$decimalSymbol = _ref.decimalSymbol;\n var decimalSymbol = _ref$decimalSymbol === undefined ? period : _ref$decimalSymbol;\n var _ref$decimalLimit = _ref.decimalLimit;\n var decimalLimit = _ref$decimalLimit === undefined ? 2 : _ref$decimalLimit;\n var _ref$requireDecimal = _ref.requireDecimal;\n var requireDecimal = _ref$requireDecimal === undefined ? false : _ref$requireDecimal;\n\n function numberMask(rawValue) {\n var rawValueLength = rawValue.length;\n\n if (rawValue === emptyString || rawValue[0] === prefix[0] && rawValueLength === 1) {\n return prefix.split(emptyString).concat([digitRegExp]).concat(suffix.split(emptyString));\n }\n\n var indexOfLastDecimal = rawValue.lastIndexOf(decimalSymbol);\n var hasDecimal = indexOfLastDecimal !== -1;\n\n var integer = void 0;\n var fraction = void 0;\n var mask = void 0;\n\n if (hasDecimal && (allowDecimal || requireDecimal)) {\n integer = rawValue.slice(0, indexOfLastDecimal);\n\n fraction = rawValue.slice(indexOfLastDecimal + 1, rawValueLength);\n fraction = convertToMask(fraction.replace(nonDigitsRegExp, emptyString));\n } else {\n integer = rawValue;\n }\n\n integer = integer.replace(nonDigitsRegExp, emptyString);\n\n integer = includeThousandsSeparator ? addThousandsSeparator(integer, thousandsSeparatorSymbol) : integer;\n\n mask = convertToMask(integer);\n\n if (hasDecimal && allowDecimal || requireDecimal === true) {\n if (rawValue[indexOfLastDecimal - 1] !== decimalSymbol) {\n mask.push('[]');\n }\n\n mask.push(decimalSymbol, '[]');\n\n if (fraction) {\n if ((typeof decimalLimit === 'undefined' ? 'undefined' : _typeof(decimalLimit)) === number) {\n fraction = fraction.slice(0, decimalLimit);\n }\n\n mask = mask.concat(fraction);\n } else if (requireDecimal === true) {\n for (var i = 0; i < decimalLimit; i++) {\n mask.push(digitRegExp);\n }\n }\n }\n\n if (prefix.length > 0) {\n mask = prefix.split(emptyString).concat(mask);\n }\n\n if (suffix.length > 0) {\n mask = mask.concat(suffix.split(emptyString));\n }\n\n return mask;\n }\n\n numberMask.instanceOf = 'createNumberMask';\n\n return numberMask;\n}\n\nfunction convertToMask(strNumber) {\n return strNumber.split(emptyString).map(function (char) {\n return digitRegExp.test(char) ? digitRegExp : char;\n });\n}\n\n// http://stackoverflow.com/a/10899795/604296\nfunction addThousandsSeparator(n, thousandsSeparatorSymbol) {\n return n.replace(/\\B(?=(\\d{3})+(?!\\d))/g, thousandsSeparatorSymbol);\n}"}],"filteredModules":0,"origins":[{"moduleId":0,"module":"/Users/mk/Code/github/msafi/text-mask/node_modules/babel-loader/index.js!/Users/mk/Code/github/msafi/text-mask/addons/src/createNumberMask.js","moduleIdentifier":"/Users/mk/Code/github/msafi/text-mask/node_modules/babel-loader/index.js!/Users/mk/Code/github/msafi/text-mask/addons/src/createNumberMask.js","moduleName":"./addons/src/createNumberMask.js","loc":"","name":"createNumberMask","reasons":[]}]},{"id":2,"rendered":true,"initial":true,"entry":true,"extraAsync":false,"size":1597,"names":["autoCorrectedMmddyyyyPipe"],"files":["autoCorrectedMmddyyyyPipe.js"],"hash":"9057681677456b4c37ef","parents":[],"modules":[{"id":0,"identifier":"/Users/mk/Code/github/msafi/text-mask/node_modules/babel-loader/index.js!/Users/mk/Code/github/msafi/text-mask/addons/src/autoCorrectedMmddyyyyPipe.js","name":"./addons/src/autoCorrectedMmddyyyyPipe.js","index":0,"index2":0,"size":1597,"cacheable":true,"built":true,"optional":false,"prefetched":false,"chunks":[2],"assets":[],"issuer":null,"failed":false,"errors":0,"warnings":0,"reasons":[],"source":"'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = autoCorrectedMmddyyyyPipe;\nfunction autoCorrectedMmddyyyyPipe(conformedValue) {\n var conformedValueArr = conformedValue.split('');\n var indexesOfPipedChars = [];\n\n var month1stDigit = parseDigit(conformedValue[0]);\n var month2ndDigit = parseDigit(conformedValue[1]);\n var day1stDigit = parseDigit(conformedValue[3]);\n var day2ndDigit = parseDigit(conformedValue[4]);\n var year1stDigit = parseDigit(conformedValue[6]);\n\n if (month1stDigit > 1) {\n conformedValueArr.splice(0, 2, 0, month1stDigit);\n\n indexesOfPipedChars.push(0);\n }\n\n if (month1stDigit === 1 && month2ndDigit > 2 || month1stDigit === 0 && month2ndDigit === 0) {\n return false;\n }\n\n if (day1stDigit > 3) {\n conformedValueArr.splice(3, 2, 0, day1stDigit);\n\n indexesOfPipedChars.push(3);\n }\n\n if (day1stDigit === 3 && day2ndDigit > 1 || day1stDigit === 0 && day2ndDigit === 0) {\n return false;\n }\n\n if (year1stDigit === 0) {\n conformedValueArr.splice(6, 3, 2, 0, year1stDigit);\n\n indexesOfPipedChars.push(6, 7);\n }\n\n return {\n value: conformedValueArr.join(''),\n indexesOfPipedChars: indexesOfPipedChars\n };\n}\n\nvar digitsNumbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];\nvar digitsStrings = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];\nvar allDigits = digitsNumbers.concat(digitsStrings);\nfunction parseDigit(value) {\n var digit = allDigits.find(function (digit) {\n return digit === value;\n });\n\n if (digit === undefined) {\n return value;\n } else {\n return Number(digit);\n }\n}"}],"filteredModules":0,"origins":[{"moduleId":0,"module":"/Users/mk/Code/github/msafi/text-mask/node_modules/babel-loader/index.js!/Users/mk/Code/github/msafi/text-mask/addons/src/autoCorrectedMmddyyyyPipe.js","moduleIdentifier":"/Users/mk/Code/github/msafi/text-mask/node_modules/babel-loader/index.js!/Users/mk/Code/github/msafi/text-mask/addons/src/autoCorrectedMmddyyyyPipe.js","moduleName":"./addons/src/autoCorrectedMmddyyyyPipe.js","loc":"","name":"autoCorrectedMmddyyyyPipe","reasons":[]}]}],"modules":[{"id":0,"identifier":"/Users/mk/Code/github/msafi/text-mask/node_modules/babel-loader/index.js!/Users/mk/Code/github/msafi/text-mask/addons/src/autoCorrectedMmddyyyyPipe.js","name":"./addons/src/autoCorrectedMmddyyyyPipe.js","index":0,"index2":0,"size":1597,"cacheable":true,"built":true,"optional":false,"prefetched":false,"chunks":[2],"assets":[],"issuer":null,"failed":false,"errors":0,"warnings":0,"reasons":[],"source":"'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = autoCorrectedMmddyyyyPipe;\nfunction autoCorrectedMmddyyyyPipe(conformedValue) {\n var conformedValueArr = conformedValue.split('');\n var indexesOfPipedChars = [];\n\n var month1stDigit = parseDigit(conformedValue[0]);\n var month2ndDigit = parseDigit(conformedValue[1]);\n var day1stDigit = parseDigit(conformedValue[3]);\n var day2ndDigit = parseDigit(conformedValue[4]);\n var year1stDigit = parseDigit(conformedValue[6]);\n\n if (month1stDigit > 1) {\n conformedValueArr.splice(0, 2, 0, month1stDigit);\n\n indexesOfPipedChars.push(0);\n }\n\n if (month1stDigit === 1 && month2ndDigit > 2 || month1stDigit === 0 && month2ndDigit === 0) {\n return false;\n }\n\n if (day1stDigit > 3) {\n conformedValueArr.splice(3, 2, 0, day1stDigit);\n\n indexesOfPipedChars.push(3);\n }\n\n if (day1stDigit === 3 && day2ndDigit > 1 || day1stDigit === 0 && day2ndDigit === 0) {\n return false;\n }\n\n if (year1stDigit === 0) {\n conformedValueArr.splice(6, 3, 2, 0, year1stDigit);\n\n indexesOfPipedChars.push(6, 7);\n }\n\n return {\n value: conformedValueArr.join(''),\n indexesOfPipedChars: indexesOfPipedChars\n };\n}\n\nvar digitsNumbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];\nvar digitsStrings = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];\nvar allDigits = digitsNumbers.concat(digitsStrings);\nfunction parseDigit(value) {\n var digit = allDigits.find(function (digit) {\n return digit === value;\n });\n\n if (digit === undefined) {\n return value;\n } else {\n return Number(digit);\n }\n}"},{"id":0,"identifier":"/Users/mk/Code/github/msafi/text-mask/node_modules/babel-loader/index.js!/Users/mk/Code/github/msafi/text-mask/addons/src/createNumberMask.js","name":"./addons/src/createNumberMask.js","index":1,"index2":1,"size":3863,"cacheable":true,"built":true,"optional":false,"prefetched":false,"chunks":[1],"assets":[],"issuer":null,"failed":false,"errors":0,"warnings":0,"reasons":[],"source":"'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol ? \"symbol\" : typeof obj; };\n\nexports.default = createNumberMask;\nvar dollarSign = '$';\nvar emptyString = '';\nvar comma = ',';\nvar period = '.';\nvar nonDigitsRegExp = /\\D+/g;\nvar number = 'number';\nvar digitRegExp = /\\d/;\n\nfunction createNumberMask() {\n var _ref = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];\n\n var _ref$prefix = _ref.prefix;\n var prefix = _ref$prefix === undefined ? dollarSign : _ref$prefix;\n var _ref$suffix = _ref.suffix;\n var suffix = _ref$suffix === undefined ? emptyString : _ref$suffix;\n var _ref$includeThousands = _ref.includeThousandsSeparator;\n var includeThousandsSeparator = _ref$includeThousands === undefined ? true : _ref$includeThousands;\n var _ref$thousandsSeparat = _ref.thousandsSeparatorSymbol;\n var thousandsSeparatorSymbol = _ref$thousandsSeparat === undefined ? comma : _ref$thousandsSeparat;\n var _ref$allowDecimal = _ref.allowDecimal;\n var allowDecimal = _ref$allowDecimal === undefined ? false : _ref$allowDecimal;\n var _ref$decimalSymbol = _ref.decimalSymbol;\n var decimalSymbol = _ref$decimalSymbol === undefined ? period : _ref$decimalSymbol;\n var _ref$decimalLimit = _ref.decimalLimit;\n var decimalLimit = _ref$decimalLimit === undefined ? 2 : _ref$decimalLimit;\n var _ref$requireDecimal = _ref.requireDecimal;\n var requireDecimal = _ref$requireDecimal === undefined ? false : _ref$requireDecimal;\n\n function numberMask(rawValue) {\n var rawValueLength = rawValue.length;\n\n if (rawValue === emptyString || rawValue[0] === prefix[0] && rawValueLength === 1) {\n return prefix.split(emptyString).concat([digitRegExp]).concat(suffix.split(emptyString));\n }\n\n var indexOfLastDecimal = rawValue.lastIndexOf(decimalSymbol);\n var hasDecimal = indexOfLastDecimal !== -1;\n\n var integer = void 0;\n var fraction = void 0;\n var mask = void 0;\n\n if (hasDecimal && (allowDecimal || requireDecimal)) {\n integer = rawValue.slice(0, indexOfLastDecimal);\n\n fraction = rawValue.slice(indexOfLastDecimal + 1, rawValueLength);\n fraction = convertToMask(fraction.replace(nonDigitsRegExp, emptyString));\n } else {\n integer = rawValue;\n }\n\n integer = integer.replace(nonDigitsRegExp, emptyString);\n\n integer = includeThousandsSeparator ? addThousandsSeparator(integer, thousandsSeparatorSymbol) : integer;\n\n mask = convertToMask(integer);\n\n if (hasDecimal && allowDecimal || requireDecimal === true) {\n if (rawValue[indexOfLastDecimal - 1] !== decimalSymbol) {\n mask.push('[]');\n }\n\n mask.push(decimalSymbol, '[]');\n\n if (fraction) {\n if ((typeof decimalLimit === 'undefined' ? 'undefined' : _typeof(decimalLimit)) === number) {\n fraction = fraction.slice(0, decimalLimit);\n }\n\n mask = mask.concat(fraction);\n } else if (requireDecimal === true) {\n for (var i = 0; i < decimalLimit; i++) {\n mask.push(digitRegExp);\n }\n }\n }\n\n if (prefix.length > 0) {\n mask = prefix.split(emptyString).concat(mask);\n }\n\n if (suffix.length > 0) {\n mask = mask.concat(suffix.split(emptyString));\n }\n\n return mask;\n }\n\n numberMask.instanceOf = 'createNumberMask';\n\n return numberMask;\n}\n\nfunction convertToMask(strNumber) {\n return strNumber.split(emptyString).map(function (char) {\n return digitRegExp.test(char) ? digitRegExp : char;\n });\n}\n\n// http://stackoverflow.com/a/10899795/604296\nfunction addThousandsSeparator(n, thousandsSeparatorSymbol) {\n return n.replace(/\\B(?=(\\d{3})+(?!\\d))/g, thousandsSeparatorSymbol);\n}"},{"id":0,"identifier":"/Users/mk/Code/github/msafi/text-mask/node_modules/babel-loader/index.js!/Users/mk/Code/github/msafi/text-mask/addons/src/emailMask.js","name":"./addons/src/emailMask.js","index":2,"index2":3,"size":3851,"cacheable":true,"built":true,"optional":false,"prefetched":false,"chunks":[0],"assets":[],"issuer":null,"failed":false,"errors":0,"warnings":0,"reasons":[],"source":"'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _emailPipe = require('./emailPipe.js');\n\nvar _emailPipe2 = _interopRequireDefault(_emailPipe);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar asterisk = '*';\nvar dot = '.';\nvar emptyString = '';\nvar atSymbol = '@';\nvar caretTrap = '[]';\nvar space = ' ';\nvar g = 'g';\nvar anyNonWhitespaceRegExp = /[^\\s]/;\nvar anyNonDotOrWhitespaceRegExp = /[^.\\s]/;\nvar allWhitespaceRegExp = /\\s/g;\n\nfunction emailMask(rawValue, config) {\n rawValue = rawValue.replace(allWhitespaceRegExp, emptyString);\n\n var placeholderChar = config.placeholderChar;\n var currentCaretPosition = config.currentCaretPosition;\n\n var indexOfFirstAtSymbol = rawValue.indexOf(atSymbol);\n var indexOfLastDot = rawValue.lastIndexOf(dot);\n var indexOfTopLevelDomainDot = indexOfLastDot < indexOfFirstAtSymbol ? -1 : indexOfLastDot;\n\n var localPartToDomainConnector = getConnector(rawValue, indexOfFirstAtSymbol + 1, atSymbol);\n var domainNameToTopLevelDomainConnector = getConnector(rawValue, indexOfTopLevelDomainDot - 1, dot);\n\n var localPart = getLocalPart(rawValue, indexOfFirstAtSymbol, placeholderChar);\n var domainName = getDomainName(rawValue, indexOfFirstAtSymbol, indexOfTopLevelDomainDot, placeholderChar);\n var topLevelDomain = getTopLevelDomain(rawValue, indexOfTopLevelDomainDot, placeholderChar, currentCaretPosition);\n\n localPart = convertToMask(localPart);\n domainName = convertToMask(domainName);\n topLevelDomain = convertToMask(topLevelDomain, true);\n\n var mask = localPart.concat(localPartToDomainConnector).concat(domainName).concat(domainNameToTopLevelDomainConnector).concat(topLevelDomain);\n\n return mask;\n}\n\nfunction getConnector(rawValue, indexOfConnection, connectionSymbol) {\n var connector = [];\n\n if (rawValue[indexOfConnection] === connectionSymbol) {\n connector.push(connectionSymbol);\n } else {\n connector.push(caretTrap, connectionSymbol);\n }\n\n connector.push(caretTrap);\n\n return connector;\n}\n\nfunction getLocalPart(rawValue, indexOfFirstAtSymbol) {\n if (indexOfFirstAtSymbol === -1) {\n return rawValue;\n } else {\n return rawValue.slice(0, indexOfFirstAtSymbol);\n }\n}\n\nfunction getDomainName(rawValue, indexOfFirstAtSymbol, indexOfTopLevelDomainDot, placeholderChar) {\n var domainName = emptyString;\n\n if (indexOfFirstAtSymbol !== -1) {\n if (indexOfTopLevelDomainDot === -1) {\n domainName = rawValue.slice(indexOfFirstAtSymbol + 1, rawValue.length);\n } else {\n domainName = rawValue.slice(indexOfFirstAtSymbol + 1, indexOfTopLevelDomainDot);\n }\n }\n\n domainName = domainName.replace(new RegExp('[\\\\s' + placeholderChar + ']', g), emptyString);\n\n if (domainName === atSymbol) {\n return asterisk;\n } else if (domainName.length < 1) {\n return space;\n } else if (domainName[domainName.length - 1] === dot) {\n return domainName.slice(0, domainName.length - 1);\n } else {\n return domainName;\n }\n}\n\nfunction getTopLevelDomain(rawValue, indexOfTopLevelDomainDot, placeholderChar, currentCaretPosition) {\n var topLevelDomain = emptyString;\n\n if (indexOfTopLevelDomainDot !== -1) {\n topLevelDomain = rawValue.slice(indexOfTopLevelDomainDot + 1, rawValue.length);\n }\n\n topLevelDomain = topLevelDomain.replace(new RegExp('[\\\\s' + placeholderChar + '.]', g), emptyString);\n\n if (topLevelDomain.length === 0) {\n return rawValue[indexOfTopLevelDomainDot - 1] === dot && currentCaretPosition !== rawValue.length ? asterisk : emptyString;\n } else {\n return topLevelDomain;\n }\n}\n\nfunction convertToMask(str, noDots) {\n return str.split(emptyString).map(function (char) {\n return char === space ? char : noDots ? anyNonDotOrWhitespaceRegExp : anyNonWhitespaceRegExp;\n });\n}\n\nexports.default = { mask: emailMask, pipe: _emailPipe2.default };"},{"id":1,"identifier":"/Users/mk/Code/github/msafi/text-mask/node_modules/babel-loader/index.js!/Users/mk/Code/github/msafi/text-mask/addons/src/emailPipe.js","name":"./addons/src/emailPipe.js","index":3,"index2":2,"size":1571,"cacheable":true,"built":true,"optional":false,"prefetched":false,"chunks":[0],"assets":[],"issuer":"/Users/mk/Code/github/msafi/text-mask/node_modules/babel-loader/index.js!/Users/mk/Code/github/msafi/text-mask/addons/src/emailMask.js","failed":false,"errors":0,"warnings":0,"reasons":[{"moduleId":0,"moduleIdentifier":"/Users/mk/Code/github/msafi/text-mask/node_modules/babel-loader/index.js!/Users/mk/Code/github/msafi/text-mask/addons/src/emailMask.js","module":"./addons/src/emailMask.js","moduleName":"./addons/src/emailMask.js","type":"cjs require","userRequest":"./emailPipe.js","loc":"7:17-42"}],"source":"'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = emailPipe;\nvar atSymbol = '@';\nvar allAtSymbolsRegExp = /@/g;\nvar emptyString = '';\nvar atDot = '@.';\nvar dot = '.';\nvar dotDot = '..';\nvar emptyArray = [];\nvar allDotsRegExp = /\\./g;\n\nfunction emailPipe(conformedValue, config) {\n var currentCaretPosition = config.currentCaretPosition;\n var rawValue = config.rawValue;\n var previousConformedValue = config.previousConformedValue;\n var placeholderChar = config.placeholderChar;\n\n\n var value = conformedValue;\n\n value = removeAllAtSymbolsButFirst(value);\n\n var indexOfAtDot = value.indexOf(atDot);\n\n var emptyEmail = rawValue.match(new RegExp('[^@\\\\s.' + placeholderChar + ']')) === null;\n\n if (emptyEmail) {\n return emptyString;\n }\n\n if (value.indexOf(dotDot) !== -1 || indexOfAtDot !== -1 && currentCaretPosition !== indexOfAtDot + 1 || rawValue.indexOf(atSymbol) === -1 && previousConformedValue !== emptyString && rawValue.indexOf(dot) !== -1) {\n return false;\n }\n\n var indexOfAtSymbol = value.indexOf(atSymbol);\n var domainPart = value.slice(indexOfAtSymbol + 1, value.length);\n\n if ((domainPart.match(allDotsRegExp) || emptyArray).length > 1 && value.substr(-1) === dot && currentCaretPosition !== rawValue.length) {\n value = value.slice(0, value.length - 1);\n }\n\n return value;\n}\n\nfunction removeAllAtSymbolsButFirst(str) {\n var atSymbolCount = 0;\n\n return str.replace(allAtSymbolsRegExp, function () {\n atSymbolCount++;\n\n return atSymbolCount === 1 ? atSymbol : emptyString;\n });\n}"}],"filteredModules":0,"children":[]}
{
"name": "text-mask-addons",
"version": "0.6.0",
"description": "Addons for Text Mask https://github.com/msafi/text-mask",
"version": "0.7.0",
"description": "Addons for Text Mask https://github.com/text-mask/text-mask",
"author": "M.K. Safi <msafi@msafi.com>",
"license": "CC0-1.0",
"bugs": {
"url": "https://github.com/msafi/text-mask/issues"
"url": "https://github.com/text-mask/text-mask/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/msafi/text-mask.git"
"url": "https://github.com/text-mask/text-mask.git"
},
"homepage": "https://github.com/msafi/text-mask/tree/master/addons/#readme",
"homepage": "https://github.com/text-mask/text-mask/tree/master/addons/#readme",
"keywords": [

@@ -16,0 +16,0 @@ "text mask",

@@ -14,3 +14,3 @@ # Text Mask Addons

These can be passed as a
[`mask`](https://github.com/msafi/text-mask/blob/master/componentDocumentation.md#mask)
[`mask`](https://github.com/text-mask/text-mask/blob/master/componentDocumentation.md#mask)
to Text Mask.

@@ -64,3 +64,3 @@

These functions here can be passed as a
[`pipe`](https://github.com/msafi/text-mask/blob/master/componentDocumentation.md#pipe)
[`pipe`](https://github.com/text-mask/text-mask/blob/master/componentDocumentation.md#pipe)
to Text Mask.

@@ -82,3 +82,3 @@

configured with
[`keepCharPositions`](https://github.com/msafi/text-mask/blob/master/componentDocumentation.md#keepcharpositions)
[`keepCharPositions`](https://github.com/text-mask/text-mask/blob/master/componentDocumentation.md#keepcharpositions)
set to `true`.

@@ -85,0 +85,0 @@

@@ -34,3 +34,3 @@ import createTextMaskInputElement from '../../core/src/createTextMaskInputElement.js'

input('a@@ .', 2)
expectResults('a@_.', 2)
expectResults('a@.', 2)
})

@@ -106,3 +106,3 @@

input('a@@ .', 2)
expectResults('a@_.', 2)
expectResults('a@.', 2)

@@ -109,0 +109,0 @@ input('a@f_.', 3)

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