PATH:
opt
/
bitninja-dispatcher
/
node_modules
/
libphonenumber-js
/
build
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } var PatternParser = /*#__PURE__*/function () { function PatternParser() { _classCallCheck(this, PatternParser); } _createClass(PatternParser, [{ key: "parse", value: function parse(pattern) { this.context = [{ or: true, instructions: [] }]; this.parsePattern(pattern); if (this.context.length !== 1) { throw new Error('Non-finalized contexts left when pattern parse ended'); } var _this$context$ = this.context[0], branches = _this$context$.branches, instructions = _this$context$.instructions; if (branches) { return { op: '|', args: branches.concat([expandSingleElementArray(instructions)]) }; } /* istanbul ignore if */ if (instructions.length === 0) { throw new Error('Pattern is required'); } if (instructions.length === 1) { return instructions[0]; } return instructions; } }, { key: "startContext", value: function startContext(context) { this.context.push(context); } }, { key: "endContext", value: function endContext() { this.context.pop(); } }, { key: "getContext", value: function getContext() { return this.context[this.context.length - 1]; } }, { key: "parsePattern", value: function parsePattern(pattern) { if (!pattern) { throw new Error('Pattern is required'); } var match = pattern.match(OPERATOR); if (!match) { if (ILLEGAL_CHARACTER_REGEXP.test(pattern)) { throw new Error("Illegal characters found in a pattern: ".concat(pattern)); } this.getContext().instructions = this.getContext().instructions.concat(pattern.split('')); return; } var operator = match[1]; var before = pattern.slice(0, match.index); var rightPart = pattern.slice(match.index + operator.length); switch (operator) { case '(?:': if (before) { this.parsePattern(before); } this.startContext({ or: true, instructions: [], branches: [] }); break; case ')': if (!this.getContext().or) { throw new Error('")" operator must be preceded by "(?:" operator'); } if (before) { this.parsePattern(before); } if (this.getContext().instructions.length === 0) { throw new Error('No instructions found after "|" operator in an "or" group'); } var _this$getContext = this.getContext(), branches = _this$getContext.branches; branches.push(expandSingleElementArray(this.getContext().instructions)); this.endContext(); this.getContext().instructions.push({ op: '|', args: branches }); break; case '|': if (!this.getContext().or) { throw new Error('"|" operator can only be used inside "or" groups'); } if (before) { this.parsePattern(before); } // The top-level is an implicit "or" group, if required. if (!this.getContext().branches) { // `branches` are not defined only for the root implicit "or" operator. /* istanbul ignore else */ if (this.context.length === 1) { this.getContext().branches = []; } else { throw new Error('"branches" not found in an "or" group context'); } } this.getContext().branches.push(expandSingleElementArray(this.getContext().instructions)); this.getContext().instructions = []; break; case '[': if (before) { this.parsePattern(before); } this.startContext({ oneOfSet: true }); break; case ']': if (!this.getContext().oneOfSet) { throw new Error('"]" operator must be preceded by "[" operator'); } this.endContext(); this.getContext().instructions.push({ op: '[]', args: parseOneOfSet(before) }); break; /* istanbul ignore next */ default: throw new Error("Unknown operator: ".concat(operator)); } if (rightPart) { this.parsePattern(rightPart); } } }]); return PatternParser; }(); exports["default"] = PatternParser; function parseOneOfSet(pattern) { var values = []; var i = 0; while (i < pattern.length) { if (pattern[i] === '-') { if (i === 0 || i === pattern.length - 1) { throw new Error("Couldn't parse a one-of set pattern: ".concat(pattern)); } var prevValue = pattern[i - 1].charCodeAt(0) + 1; var nextValue = pattern[i + 1].charCodeAt(0) - 1; var value = prevValue; while (value <= nextValue) { values.push(String.fromCharCode(value)); value++; } } else { values.push(pattern[i]); } i++; } return values; } var ILLEGAL_CHARACTER_REGEXP = /[\(\)\[\]\?\:\|]/; var OPERATOR = new RegExp( // any of: '(' + // or operator '\\|' + // or '|' + // or group start '\\(\\?\\:' + // or '|' + // or group end '\\)' + // or '|' + // one-of set start '\\[' + // or '|' + // one-of set end '\\]' + ')'); function expandSingleElementArray(array) { if (array.length === 1) { return array[0]; } return array; } //# sourceMappingURL=AsYouTypeFormatter.PatternParser.js.map
[+]
..
[-] parsePhoneNumberFromString.test.js
[edit]
[-] AsYouTypeFormatter.PatternMatcher.js.map
[edit]
[-] parseIncompletePhoneNumber.js.map
[edit]
[-] metadata.js
[edit]
[-] isPossibleNumber_.js.map
[edit]
[-] PhoneNumber.js
[edit]
[-] findNumbers.js.map
[edit]
[-] parsePhoneNumber.js
[edit]
[-] isPossibleNumber.test.js.map
[edit]
[-] isPossiblePhoneNumber.test.js
[edit]
[-] findNumbers.js
[edit]
[-] isPossibleNumber.js
[edit]
[-] getNumberType.js
[edit]
[-] getNumberType.js.map
[edit]
[-] AsYouTypeFormatter.PatternMatcher.js
[edit]
[-] parseIncompletePhoneNumber.test.js.map
[edit]
[-] parse_.js
[edit]
[-] getExampleNumber.js.map
[edit]
[-] format.test.js.map
[edit]
[-] parsePhoneNumber_.js.map
[edit]
[-] getExampleNumber.test.js
[edit]
[-] AsYouTypeState.js.map
[edit]
[-] formatNumberForMobileDialing.js.map
[edit]
[-] formatIncompletePhoneNumber.test.js.map
[edit]
[-] AsYouTypeParser.js
[edit]
[-] getExampleNumber.test.js.map
[edit]
[-] validate_.js
[edit]
[-] PhoneNumberMatcher.js.map
[edit]
[-] parsePhoneNumberFromString_.js
[edit]
[-] getNumberType.test.js.map
[edit]
[-] getCountryCallingCode.js.map
[edit]
[-] AsYouTypeFormatter.PatternMatcher.test.js.map
[edit]
[-] searchPhoneNumbersInText.test.js
[edit]
[-] isValidPhoneNumber.test.js.map
[edit]
[-] format_.js.map
[edit]
[-] constants.js.map
[edit]
[-] parse.js.map
[edit]
[-] AsYouTypeFormatter.js.map
[edit]
[-] getCountries.test.js
[edit]
[-] searchPhoneNumbersInText.js
[edit]
[-] AsYouTypeFormatter.PatternParser.test.js
[edit]
[-] isPossiblePhoneNumber.test.js.map
[edit]
[-] PhoneNumber.test.js.map
[edit]
[-] parsePhoneNumber.test.js.map
[edit]
[-] formatNumberForMobileDialing.js
[edit]
[-] AsYouTypeFormatter.util.test.js.map
[edit]
[-] getCountryCallingCode.js
[edit]
[-] searchNumbers.test.js.map
[edit]
[-] findPhoneNumbers.test.js
[edit]
[-] package.json
[edit]
[-] isPossibleNumber.js.map
[edit]
[-] parsePhoneNumber.test.js
[edit]
[-] isValidPhoneNumber.test.js
[edit]
[-] metadata.test.js.map
[edit]
[-] searchPhoneNumbersInText.test.js.map
[edit]
[-] AsYouTypeFormatter.PatternParser.test.js.map
[edit]
[-] AsYouType.test.js
[edit]
[-] isPossiblePhoneNumber.js.map
[edit]
[-] getCountries.js
[edit]
[-] validate.test.js
[edit]
[-] getCountryCallingCode.test.js.map
[edit]
[-] AsYouTypeFormatter.js
[edit]
[-] PhoneNumberMatcher.js
[edit]
[-] validate.test.js.map
[edit]
[-] findNumbers_.js
[edit]
[-] getCountries.js.map
[edit]
[-] formatIncompletePhoneNumber.test.js
[edit]
[-] format.test.js
[edit]
[-] findPhoneNumbers.js
[edit]
[-] searchNumbers.js
[edit]
[-] findPhoneNumbersInText.test.js.map
[edit]
[-] findPhoneNumbersInText.js
[edit]
[-] findPhoneNumbersInText.test.js
[edit]
[-] metadata.test.js
[edit]
[-] validatePhoneNumberLength.test.js.map
[edit]
[-] parse.js
[edit]
[-] validate_.js.map
[edit]
[-] validatePhoneNumberLength.test.js
[edit]
[-] format.js.map
[edit]
[-] findNumbers.test.js
[edit]
[-] AsYouTypeFormatter.complete.js.map
[edit]
[+]
tools
[-] AsYouTypeParser.js.map
[edit]
[-] parsePhoneNumberFromString.js
[edit]
[-] getCountryCallingCode.test.js
[edit]
[-] isPossibleNumber.test.js
[edit]
[-] findPhoneNumbers.test.js.map
[edit]
[-] AsYouTypeFormatter.PatternParser.js.map
[edit]
[-] parse.test.js
[edit]
[-] parsePhoneNumber_.js
[edit]
[-] parsePhoneNumberFromString_.js.map
[edit]
[-] ParseError.js
[edit]
[-] searchNumbers.js.map
[edit]
[-] PhoneNumber.test.js
[edit]
[-] AsYouTypeFormatter.PatternMatcher.test.js
[edit]
[-] getNumberType.test.js
[edit]
[-] AsYouTypeFormatter.PatternParser.js
[edit]
[-] validatePhoneNumberLength.js
[edit]
[-] isValidPhoneNumber.js
[edit]
[-] PhoneNumber.js.map
[edit]
[-] parsePhoneNumberFromString.js.map
[edit]
[-] isValidNumberForRegion.js.map
[edit]
[+]
helpers
[-] parseIncompletePhoneNumber.test.js
[edit]
[-] formatNumberForMobileDialing.test.js
[edit]
[-] isValidNumberForRegion_.js.map
[edit]
[-] parse.test.js.map
[edit]
[-] isValidNumberForRegion_.js
[edit]
[-] PhoneNumberMatcher.test.js
[edit]
[-] isPossibleNumber_.js
[edit]
[-] AsYouTypeFormatter.util.js
[edit]
[-] format.js
[edit]
[-] isValidNumberForRegion.test.js
[edit]
[-] AsYouType.js
[edit]
[-] AsYouTypeFormatter.complete.js
[edit]
[-] formatNumberForMobileDialing.test.js.map
[edit]
[+]
findNumbers
[-] findNumbers_.js.map
[edit]
[-] getExampleNumber.js
[edit]
[-] format_.js
[edit]
[-] isPossiblePhoneNumber.js
[edit]
[-] findPhoneNumbers_.js
[edit]
[-] isValidNumberForRegion.test.js.map
[edit]
[-] AsYouType.test.js.map
[edit]
[-] isValidNumberForRegion.js
[edit]
[-] ParseError.js.map
[edit]
[-] parsePhoneNumberFromString.test.js.map
[edit]
[-] findPhoneNumbersInText.js.map
[edit]
[-] findPhoneNumbers.js.map
[edit]
[-] getCountries.test.js.map
[edit]
[-] validate.js
[edit]
[-] AsYouTypeState.js
[edit]
[-] parsePhoneNumber.js.map
[edit]
[-] formatIncompletePhoneNumber.js
[edit]
[-] AsYouTypeFormatter.util.js.map
[edit]
[-] constants.js
[edit]
[-] validate.js.map
[edit]
[-] PhoneNumberMatcher.test.js.map
[edit]
[-] parse_.js.map
[edit]
[-] findNumbers.test.js.map
[edit]
[-] findPhoneNumbers_.js.map
[edit]
[-] metadata.js.map
[edit]
[-] parseIncompletePhoneNumber.js
[edit]
[-] searchNumbers.test.js
[edit]
[-] AsYouType.js.map
[edit]
[-] searchPhoneNumbersInText.js.map
[edit]
[-] validatePhoneNumberLength.js.map
[edit]
[-] AsYouTypeFormatter.util.test.js
[edit]
[-] formatIncompletePhoneNumber.js.map
[edit]
[-] isValidPhoneNumber.js.map
[edit]