diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..845c013 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,20 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "node", + "request": "launch", + "name": "Launch Program", + "skipFiles": [ + "/**" + ], + "program": "${workspaceFolder}/dist/diacritic-remover.js", + "outFiles": [ + "${workspaceFolder}/**/*.js" + ] + } + ] +} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..62ebdbe --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,13 @@ + +# *diacritic-remover* changelog +## 1.0.3 +* added input char in matcher, insensitiveMatcher and matcherBy outputs +* Changelog moved into CHANGELOG.md +## 1.0.2 +* matcherBy Refactoring +## 1.0.1 +* matcherBy fix +* type d.ts +* source maps +## 1.0.0 +* First version \ No newline at end of file diff --git a/README.md b/README.md index 8833d29..15eef27 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,8 @@ Typescript library to handle and remove diacritics from strings +## [CHANGELOG](CHANGELOG.md) + ## INSTALLATION ```{r, engine='bash', global_install} npm i -s @marketto/diacritic-remover @@ -97,16 +99,6 @@ diacriticRemover.insensitiveValidator.A.test('À'); //true diacriticRemover.matcherBy(/^[au]$/); //áäâàåÄąāãăúûüùůŭųūư ``` -## CHANGELOG -### 1.0.2 -* matcherBy Refactoring -### 1.0.1 -* matcherBy fix -* type d.ts -* source maps -### 1.0.0 -* First version - ## LICENSE [MIT License](LICENSE) diff --git a/dist/diacritic-remover.bundle.js b/dist/diacritic-remover.bundle.js index 9e223b2..1e401ab 100644 --- a/dist/diacritic-remover.bundle.js +++ b/dist/diacritic-remover.bundle.js @@ -1,5 +1,5 @@ /** - * @marketto/diacritic-remover 1.0.2 + * @marketto/diacritic-remover 1.0.3 * Copyright (c) 2019, Marco Ricupero * License: MIT * ============================================================ @@ -7,19 +7,5 @@ * Article: https://en.wikipedia.org/wiki/Diacritic * License: CC-BY-SA 3.0 */ -var DiacriticFilter=function(){"use strict"; -/*! ***************************************************************************** - Copyright (c) Microsoft Corporation. All rights reserved. - Licensed under the Apache License, Version 2.0 (the "License"); you may not use - this file except in compliance with the License. You may obtain a copy of the - License at http://www.apache.org/licenses/LICENSE-2.0 - - THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED - WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, - MERCHANTABLITY OR NON-INFRINGEMENT. - - See the Apache Version 2.0 License for specific language governing permissions - and limitations under the License. - ***************************************************************************** */var t=function(r,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var n in r)r.hasOwnProperty(n)&&(t[n]=r[n])})(r,n)};function r(r,n){function e(){this.constructor=r}t(r,n),r.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}function n(t){return"string"==typeof t}var e=function(){function t(){}return t.prototype.get=function(t,r,e){return n(r)&&1===r.length?this.diacriticTrap(t,r):Reflect.get(t,r,e)},t.prototype.has=function(t,r){return n(r)&&1===r.length||Reflect.has(t,r)},t.prototype.diacriticTrap=function(t,r){},t}(),i=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.diacriticTrap=function(r,e){t.prototype.diacriticTrap.call(this,r,e);var i=r.isUpperCase(e),o=e.toLowerCase(),c=Object.keys(r.dictionary).find((function(t){return n(r.dictionary[t])&&r.dictionary[t].includes(o)}));return i&&c?c.toUpperCase():c||e},e}(e),o=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return r(n,t),n.prototype.diacriticTrap=function(r,n){t.prototype.diacriticTrap.call(this,r,n);var e=r.dictionary[n.toLowerCase()];return e?r.isUpperCase(n)?e.toUpperCase():e:n},n}(e),c=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return r(n,t),n.prototype.diacriticTrap=function(r,n){t.prototype.diacriticTrap.call(this,r,n);var e=r.dictionary[n.toLowerCase()];return e?e+e.toUpperCase():n},n}(e),a=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return r(n,t),n.prototype.diacriticTrap=function(r,n){t.prototype.diacriticTrap.call(this,r,n);var e=r.dictionary[n.toLowerCase()],i="";return e&&(i=r.isUpperCase(n)?e.toUpperCase():e),new RegExp("["+n+i+"]","u")},n}(e),u=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return r(n,t),n.prototype.diacriticTrap=function(r,n){return t.prototype.diacriticTrap.call(this,r,n),new RegExp("["+n+(r.insensitiveMatcher[n]||"")+"]","ui")},n}(e),p=function(){function t(t){var r=t.reduce((function(t,r){return Object.entries(r).forEach((function(r){var e=r[0],i=r[1];if(n(i))if(e in t){var o=i.split("").filter((function(r){return!t[e].includes(r)})).join("");t[e]+=o}else t[e]=i})),t}),{});this.dictionary=Object.freeze(r),this.matcher=new Proxy(this,new o),this.insensitiveMatcher=new Proxy(this,new c),this.validator=new Proxy(this,new a),this.insensitiveValidator=new Proxy(this,new u)}return t.prototype.matcherBy=function(t){return function(){for(var t=0,r=0,n=arguments.length;re(t)&&t.includes(s))||[];return i&&a?a.toUpperCase():e(a)?a:r}}class i extends t{diacriticTrap(e,t){let r=super.diacriticTrap(e,t);const i=e.dictionary[t.toLowerCase()];return i&&(r+=e.isUpperCase(r)?i.toUpperCase():i),r}}class s extends t{diacriticTrap(e,t){const r=super.diacriticTrap(e,t).toLowerCase(),i=new Set([r,r.toUpperCase()]);return[...e.dictionary[r]||""].forEach(e=>{i.add(e),i.add(e.toUpperCase())}),[...i].sort().join("")}}class a extends t{diacriticTrap(e,t){super.diacriticTrap(e,t);const r=e.dictionary[t.toLowerCase()];let i="";return r&&(i=e.isUpperCase(t)?r.toUpperCase():r),new RegExp(`[${t}${i}]`,"u")}}class n extends t{diacriticTrap(e,t){return super.diacriticTrap(e,t),new RegExp(`[${t}${e.insensitiveMatcher[t]||""}]`,"ui")}}class c{constructor(e){const t=e.reduce((e,t)=>Object.entries(t).reduce((e,[t,r])=>Object.assign(Object.assign({},e),{[t]:(e[t]||"")+r}),e),{});Object.entries(t).forEach(([e,r])=>{t[e]=[...new Set([...r])].sort().join("")}),this.dictionary=Object.freeze(t),this.matcher=new Proxy(this,new i),this.insensitiveMatcher=new Proxy(this,new s),this.validator=new Proxy(this,new a),this.insensitiveValidator=new Proxy(this,new n)}matcherBy(e){return[...Object.entries(this.dictionary).filter(([t,r])=>r&&e.test(t)).map(([e,t])=>e+t),...Object.entries(this.dictionary).filter(([t,r])=>r&&e.test(t.toUpperCase())).map(([e,t])=>(e+t).toUpperCase())].join("")}replace(e){return e.replace(/./g,e=>this[e])}isUpperCase(e=""){return e.toUpperCase()===e}isLowerCase(e=""){return e.toLowerCase()===e}}var o={a:"áäâàåÄąāãă",e:"éèêëěÊęėēё",i:"íîïi̇řìįī",o:"óôöòøōõơ",u:"úûüùůŭųūư",y:"ýÿŷỳ",n:"ñňŋņń",l:"ḷŀłļĺľ",h:"ḥĥȟħ",c:"çčćĉĊ",g:"ğĝǧģĠġ",s:"şšŝṣșſś","у":"ў","и":"йѝ","е":"ё",d:"đďðḏ",z:"žŻźż",t:"ťțțṭ",w:"ẅŵẃẁ",ae:"æ",ss:"ß","α":"ά","ε":"έ","η":"ή","ι":"ίΐϊ","ο":"ό","υ":"ύΰϋ","ω":"ώ",j:"ĵ",oe:"œ","":"ʰ'ʼ·׳",ii:"î",k:"ķ","к":"ќ","г":"ѓґ",ij:"ij",r:"ŕ","і":"ї"};return class extends c{constructor(...e){return super(e.length?e:[o]),Object.defineProperty(this,"dictionary",{enumerable:!1,configurable:!1}),new Proxy(this,new r)}}}(); //# sourceMappingURL=diacritic-remover.bundle.js.map diff --git a/dist/diacritic-remover.bundle.js.map b/dist/diacritic-remover.bundle.js.map index 5ce079f..8c02c7e 100644 --- a/dist/diacritic-remover.bundle.js.map +++ b/dist/diacritic-remover.bundle.js.map @@ -1 +1 @@ -{"version":3,"file":"diacritic-remover.bundle.js","sources":["../node_modules/tslib/tslib.es6.js","../node_modules/rollup-plugin-node-builtins/src/es6/util.js","../src/classes/diacritic-abstract-handler.class.ts","../src/classes/diacritic-remover-handler.class.ts","../src/classes/diacritic-matcher-handler.class.ts","../src/classes/diacritic-insensitive-matcher-handler.class.ts","../src/classes/diacritic-validator-handler.class.ts","../src/classes/diacritic-insensitive-validator-handler.class.ts","../src/classes/diacritic-mapper-core.class.ts","../src/i18n/i18n-all.const.ts","../src/classes/diacritic-remover.class.ts"],"sourcesContent":["/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\r\n if (m) return m.call(o);\r\n return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\nimport process from 'process';\nvar formatRegExp = /%[sdj%]/g;\nexport function format(f) {\n if (!isString(f)) {\n var objects = [];\n for (var i = 0; i < arguments.length; i++) {\n objects.push(inspect(arguments[i]));\n }\n return objects.join(' ');\n }\n\n var i = 1;\n var args = arguments;\n var len = args.length;\n var str = String(f).replace(formatRegExp, function(x) {\n if (x === '%%') return '%';\n if (i >= len) return x;\n switch (x) {\n case '%s': return String(args[i++]);\n case '%d': return Number(args[i++]);\n case '%j':\n try {\n return JSON.stringify(args[i++]);\n } catch (_) {\n return '[Circular]';\n }\n default:\n return x;\n }\n });\n for (var x = args[i]; i < len; x = args[++i]) {\n if (isNull(x) || !isObject(x)) {\n str += ' ' + x;\n } else {\n str += ' ' + inspect(x);\n }\n }\n return str;\n};\n\n\n// Mark that a method should not be used.\n// Returns a modified function which warns once by default.\n// If --no-deprecation is set, then it is a no-op.\nexport function deprecate(fn, msg) {\n // Allow for deprecating things in the process of starting up.\n if (isUndefined(global.process)) {\n return function() {\n return deprecate(fn, msg).apply(this, arguments);\n };\n }\n\n if (process.noDeprecation === true) {\n return fn;\n }\n\n var warned = false;\n function deprecated() {\n if (!warned) {\n if (process.throwDeprecation) {\n throw new Error(msg);\n } else if (process.traceDeprecation) {\n console.trace(msg);\n } else {\n console.error(msg);\n }\n warned = true;\n }\n return fn.apply(this, arguments);\n }\n\n return deprecated;\n};\n\n\nvar debugs = {};\nvar debugEnviron;\nexport function debuglog(set) {\n if (isUndefined(debugEnviron))\n debugEnviron = process.env.NODE_DEBUG || '';\n set = set.toUpperCase();\n if (!debugs[set]) {\n if (new RegExp('\\\\b' + set + '\\\\b', 'i').test(debugEnviron)) {\n var pid = 0;\n debugs[set] = function() {\n var msg = format.apply(null, arguments);\n console.error('%s %d: %s', set, pid, msg);\n };\n } else {\n debugs[set] = function() {};\n }\n }\n return debugs[set];\n};\n\n\n/**\n * Echos the value of a value. Trys to print the value out\n * in the best way possible given the different types.\n *\n * @param {Object} obj The object to print out.\n * @param {Object} opts Optional options object that alters the output.\n */\n/* legacy: obj, showHidden, depth, colors*/\nexport function inspect(obj, opts) {\n // default options\n var ctx = {\n seen: [],\n stylize: stylizeNoColor\n };\n // legacy...\n if (arguments.length >= 3) ctx.depth = arguments[2];\n if (arguments.length >= 4) ctx.colors = arguments[3];\n if (isBoolean(opts)) {\n // legacy...\n ctx.showHidden = opts;\n } else if (opts) {\n // got an \"options\" object\n _extend(ctx, opts);\n }\n // set default options\n if (isUndefined(ctx.showHidden)) ctx.showHidden = false;\n if (isUndefined(ctx.depth)) ctx.depth = 2;\n if (isUndefined(ctx.colors)) ctx.colors = false;\n if (isUndefined(ctx.customInspect)) ctx.customInspect = true;\n if (ctx.colors) ctx.stylize = stylizeWithColor;\n return formatValue(ctx, obj, ctx.depth);\n}\n\n// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics\ninspect.colors = {\n 'bold' : [1, 22],\n 'italic' : [3, 23],\n 'underline' : [4, 24],\n 'inverse' : [7, 27],\n 'white' : [37, 39],\n 'grey' : [90, 39],\n 'black' : [30, 39],\n 'blue' : [34, 39],\n 'cyan' : [36, 39],\n 'green' : [32, 39],\n 'magenta' : [35, 39],\n 'red' : [31, 39],\n 'yellow' : [33, 39]\n};\n\n// Don't use 'blue' not visible on cmd.exe\ninspect.styles = {\n 'special': 'cyan',\n 'number': 'yellow',\n 'boolean': 'yellow',\n 'undefined': 'grey',\n 'null': 'bold',\n 'string': 'green',\n 'date': 'magenta',\n // \"name\": intentionally not styling\n 'regexp': 'red'\n};\n\n\nfunction stylizeWithColor(str, styleType) {\n var style = inspect.styles[styleType];\n\n if (style) {\n return '\\u001b[' + inspect.colors[style][0] + 'm' + str +\n '\\u001b[' + inspect.colors[style][1] + 'm';\n } else {\n return str;\n }\n}\n\n\nfunction stylizeNoColor(str, styleType) {\n return str;\n}\n\n\nfunction arrayToHash(array) {\n var hash = {};\n\n array.forEach(function(val, idx) {\n hash[val] = true;\n });\n\n return hash;\n}\n\n\nfunction formatValue(ctx, value, recurseTimes) {\n // Provide a hook for user-specified inspect functions.\n // Check that value is an object with an inspect function on it\n if (ctx.customInspect &&\n value &&\n isFunction(value.inspect) &&\n // Filter out the util module, it's inspect function is special\n value.inspect !== inspect &&\n // Also filter out any prototype objects using the circular check.\n !(value.constructor && value.constructor.prototype === value)) {\n var ret = value.inspect(recurseTimes, ctx);\n if (!isString(ret)) {\n ret = formatValue(ctx, ret, recurseTimes);\n }\n return ret;\n }\n\n // Primitive types cannot have properties\n var primitive = formatPrimitive(ctx, value);\n if (primitive) {\n return primitive;\n }\n\n // Look up the keys of the object.\n var keys = Object.keys(value);\n var visibleKeys = arrayToHash(keys);\n\n if (ctx.showHidden) {\n keys = Object.getOwnPropertyNames(value);\n }\n\n // IE doesn't make error fields non-enumerable\n // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx\n if (isError(value)\n && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {\n return formatError(value);\n }\n\n // Some type of object without properties can be shortcutted.\n if (keys.length === 0) {\n if (isFunction(value)) {\n var name = value.name ? ': ' + value.name : '';\n return ctx.stylize('[Function' + name + ']', 'special');\n }\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n }\n if (isDate(value)) {\n return ctx.stylize(Date.prototype.toString.call(value), 'date');\n }\n if (isError(value)) {\n return formatError(value);\n }\n }\n\n var base = '', array = false, braces = ['{', '}'];\n\n // Make Array say that they are Array\n if (isArray(value)) {\n array = true;\n braces = ['[', ']'];\n }\n\n // Make functions say that they are functions\n if (isFunction(value)) {\n var n = value.name ? ': ' + value.name : '';\n base = ' [Function' + n + ']';\n }\n\n // Make RegExps say that they are RegExps\n if (isRegExp(value)) {\n base = ' ' + RegExp.prototype.toString.call(value);\n }\n\n // Make dates with properties first say the date\n if (isDate(value)) {\n base = ' ' + Date.prototype.toUTCString.call(value);\n }\n\n // Make error with message first say the error\n if (isError(value)) {\n base = ' ' + formatError(value);\n }\n\n if (keys.length === 0 && (!array || value.length == 0)) {\n return braces[0] + base + braces[1];\n }\n\n if (recurseTimes < 0) {\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n } else {\n return ctx.stylize('[Object]', 'special');\n }\n }\n\n ctx.seen.push(value);\n\n var output;\n if (array) {\n output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);\n } else {\n output = keys.map(function(key) {\n return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);\n });\n }\n\n ctx.seen.pop();\n\n return reduceToSingleString(output, base, braces);\n}\n\n\nfunction formatPrimitive(ctx, value) {\n if (isUndefined(value))\n return ctx.stylize('undefined', 'undefined');\n if (isString(value)) {\n var simple = '\\'' + JSON.stringify(value).replace(/^\"|\"$/g, '')\n .replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"') + '\\'';\n return ctx.stylize(simple, 'string');\n }\n if (isNumber(value))\n return ctx.stylize('' + value, 'number');\n if (isBoolean(value))\n return ctx.stylize('' + value, 'boolean');\n // For some reason typeof null is \"object\", so special case here.\n if (isNull(value))\n return ctx.stylize('null', 'null');\n}\n\n\nfunction formatError(value) {\n return '[' + Error.prototype.toString.call(value) + ']';\n}\n\n\nfunction formatArray(ctx, value, recurseTimes, visibleKeys, keys) {\n var output = [];\n for (var i = 0, l = value.length; i < l; ++i) {\n if (hasOwnProperty(value, String(i))) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n String(i), true));\n } else {\n output.push('');\n }\n }\n keys.forEach(function(key) {\n if (!key.match(/^\\d+$/)) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n key, true));\n }\n });\n return output;\n}\n\n\nfunction formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {\n var name, str, desc;\n desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };\n if (desc.get) {\n if (desc.set) {\n str = ctx.stylize('[Getter/Setter]', 'special');\n } else {\n str = ctx.stylize('[Getter]', 'special');\n }\n } else {\n if (desc.set) {\n str = ctx.stylize('[Setter]', 'special');\n }\n }\n if (!hasOwnProperty(visibleKeys, key)) {\n name = '[' + key + ']';\n }\n if (!str) {\n if (ctx.seen.indexOf(desc.value) < 0) {\n if (isNull(recurseTimes)) {\n str = formatValue(ctx, desc.value, null);\n } else {\n str = formatValue(ctx, desc.value, recurseTimes - 1);\n }\n if (str.indexOf('\\n') > -1) {\n if (array) {\n str = str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n').substr(2);\n } else {\n str = '\\n' + str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n');\n }\n }\n } else {\n str = ctx.stylize('[Circular]', 'special');\n }\n }\n if (isUndefined(name)) {\n if (array && key.match(/^\\d+$/)) {\n return str;\n }\n name = JSON.stringify('' + key);\n if (name.match(/^\"([a-zA-Z_][a-zA-Z_0-9]*)\"$/)) {\n name = name.substr(1, name.length - 2);\n name = ctx.stylize(name, 'name');\n } else {\n name = name.replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"')\n .replace(/(^\"|\"$)/g, \"'\");\n name = ctx.stylize(name, 'string');\n }\n }\n\n return name + ': ' + str;\n}\n\n\nfunction reduceToSingleString(output, base, braces) {\n var numLinesEst = 0;\n var length = output.reduce(function(prev, cur) {\n numLinesEst++;\n if (cur.indexOf('\\n') >= 0) numLinesEst++;\n return prev + cur.replace(/\\u001b\\[\\d\\d?m/g, '').length + 1;\n }, 0);\n\n if (length > 60) {\n return braces[0] +\n (base === '' ? '' : base + '\\n ') +\n ' ' +\n output.join(',\\n ') +\n ' ' +\n braces[1];\n }\n\n return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];\n}\n\n\n// NOTE: These type checking functions intentionally don't use `instanceof`\n// because it is fragile and can be easily faked with `Object.create()`.\nexport function isArray(ar) {\n return Array.isArray(ar);\n}\n\nexport function isBoolean(arg) {\n return typeof arg === 'boolean';\n}\n\nexport function isNull(arg) {\n return arg === null;\n}\n\nexport function isNullOrUndefined(arg) {\n return arg == null;\n}\n\nexport function isNumber(arg) {\n return typeof arg === 'number';\n}\n\nexport function isString(arg) {\n return typeof arg === 'string';\n}\n\nexport function isSymbol(arg) {\n return typeof arg === 'symbol';\n}\n\nexport function isUndefined(arg) {\n return arg === void 0;\n}\n\nexport function isRegExp(re) {\n return isObject(re) && objectToString(re) === '[object RegExp]';\n}\n\nexport function isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\n\nexport function isDate(d) {\n return isObject(d) && objectToString(d) === '[object Date]';\n}\n\nexport function isError(e) {\n return isObject(e) &&\n (objectToString(e) === '[object Error]' || e instanceof Error);\n}\n\nexport function isFunction(arg) {\n return typeof arg === 'function';\n}\n\nexport function isPrimitive(arg) {\n return arg === null ||\n typeof arg === 'boolean' ||\n typeof arg === 'number' ||\n typeof arg === 'string' ||\n typeof arg === 'symbol' || // ES6 symbol\n typeof arg === 'undefined';\n}\n\nexport function isBuffer(maybeBuf) {\n return Buffer.isBuffer(maybeBuf);\n}\n\nfunction objectToString(o) {\n return Object.prototype.toString.call(o);\n}\n\n\nfunction pad(n) {\n return n < 10 ? '0' + n.toString(10) : n.toString(10);\n}\n\n\nvar months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',\n 'Oct', 'Nov', 'Dec'];\n\n// 26 Feb 16:19:34\nfunction timestamp() {\n var d = new Date();\n var time = [pad(d.getHours()),\n pad(d.getMinutes()),\n pad(d.getSeconds())].join(':');\n return [d.getDate(), months[d.getMonth()], time].join(' ');\n}\n\n\n// log is just a thin wrapper to console.log that prepends a timestamp\nexport function log() {\n console.log('%s - %s', timestamp(), format.apply(null, arguments));\n}\n\n\n/**\n * Inherit the prototype methods from one constructor into another.\n *\n * The Function.prototype.inherits from lang.js rewritten as a standalone\n * function (not on Function.prototype). NOTE: If this file is to be loaded\n * during bootstrapping this function needs to be rewritten using some native\n * functions as prototype setup using normal JavaScript does not work as\n * expected during bootstrapping (see mirror.js in r114903).\n *\n * @param {function} ctor Constructor function which needs to inherit the\n * prototype.\n * @param {function} superCtor Constructor function to inherit prototype from.\n */\nimport inherits from './inherits';\nexport {inherits}\n\nexport function _extend(origin, add) {\n // Don't do anything if add isn't an object\n if (!add || !isObject(add)) return origin;\n\n var keys = Object.keys(add);\n var i = keys.length;\n while (i--) {\n origin[keys[i]] = add[keys[i]];\n }\n return origin;\n};\n\nfunction hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\nexport default {\n inherits: inherits,\n _extend: _extend,\n log: log,\n isBuffer: isBuffer,\n isPrimitive: isPrimitive,\n isFunction: isFunction,\n isError: isError,\n isDate: isDate,\n isObject: isObject,\n isRegExp: isRegExp,\n isUndefined: isUndefined,\n isSymbol: isSymbol,\n isString: isString,\n isNumber: isNumber,\n isNullOrUndefined: isNullOrUndefined,\n isNull: isNull,\n isBoolean: isBoolean,\n isArray: isArray,\n inspect: inspect,\n deprecate: deprecate,\n format: format,\n debuglog: debuglog\n}\n","import { isString } from \"util\";\nimport DiacriticMapperInterface from '../interfaces/diacritic-mapper.interface';\n\nabstract class DiacriticAbstractHandler implements ProxyHandler {\n get(target: DiacriticMapperInterface, prop: PropertyKey, receiver: any): any {\n if (isString(prop) && prop.length === 1) {\n return this.diacriticTrap(target, prop);\n }\n return Reflect.get(target, prop, receiver);\n }\n\n has(target: DiacriticMapperInterface, prop: PropertyKey): boolean {\n return (isString(prop) && prop.length === 1) || Reflect.has(target, prop);\n }\n\n protected diacriticTrap(target: DiacriticMapperInterface, char: string): any {\n return;\n }\n}\n\nexport default DiacriticAbstractHandler;","import DiacriticMapperInterface from '../interfaces/diacritic-mapper.interface';\nimport DiacriticAbstractHandler from './diacritic-abstract-handler.class';\nimport { isString } from 'util';\n\nclass DiacriticRemoverHandler extends DiacriticAbstractHandler {\n protected diacriticTrap(target: DiacriticMapperInterface, char: string): string {\n super.diacriticTrap(target, char);\n const upperCase: boolean = target.isUpperCase(char);\n const lowerCaseChar = char.toLowerCase();\n\n const plainChar = Object.keys(target.dictionary)\n .find(c => isString(target.dictionary[c]) && target.dictionary[c].includes(lowerCaseChar));\n if (upperCase && plainChar) {\n return plainChar.toUpperCase();\n }\n return plainChar || char;\n }\n}\n\nexport default DiacriticRemoverHandler;","import DiacriticAbstractHandler from './diacritic-abstract-handler.class';\nimport DiacriticMapperInterface from '../interfaces/diacritic-mapper.interface';\n\nclass DiacriticMatcherHandler extends DiacriticAbstractHandler {\n protected diacriticTrap(target: DiacriticMapperInterface, char: string): string {\n super.diacriticTrap(target, char);\n const diacritics = target.dictionary[char.toLowerCase()];\n if (diacritics) {\n return target.isUpperCase(char) ? diacritics.toUpperCase() : diacritics;\n }\n return char;\n }\n}\n\nexport default DiacriticMatcherHandler;","import DiacriticAbstractHandler from './diacritic-abstract-handler.class';\nimport DiacriticMapperInterface from '../interfaces/diacritic-mapper.interface';\n\nclass DiacriticInsensitiveMatcherHandler extends DiacriticAbstractHandler {\n protected diacriticTrap(target: DiacriticMapperInterface, char: string): string {\n super.diacriticTrap(target, char);\n const diacritics = target.dictionary[char.toLowerCase()];\n return diacritics ? (\n diacritics + diacritics.toUpperCase()\n ) : char;\n }\n}\n\nexport default DiacriticInsensitiveMatcherHandler;","import DiacriticAbstractHandler from './diacritic-abstract-handler.class';\nimport DiacriticMapperInterface from '../interfaces/diacritic-mapper.interface';\n\nclass DiacriticValidatorHandler extends DiacriticAbstractHandler {\n protected diacriticTrap(target: DiacriticMapperInterface, char: string): RegExp {\n super.diacriticTrap(target, char);\n const diacritics = target.dictionary[char.toLowerCase()];\n let matchingDiacritics = '';\n if (diacritics) {\n matchingDiacritics = target.isUpperCase(char) ? diacritics.toUpperCase() : diacritics;\n }\n return new RegExp(`[${char}${matchingDiacritics}]`, 'u');\n }\n}\n\nexport default DiacriticValidatorHandler;","import DiacriticAbstractHandler from './diacritic-abstract-handler.class';\nimport DiacriticMapperInterface from '../interfaces/diacritic-mapper.interface';\n\nclass DiacriticInsensitiveValidatorHandler extends DiacriticAbstractHandler {\n protected diacriticTrap(target: DiacriticMapperInterface, char: string): RegExp {\n super.diacriticTrap(target, char);\n return new RegExp(`[${char}${target.insensitiveMatcher[char] || ''}]`, 'ui');\n }\n}\n\nexport default DiacriticInsensitiveValidatorHandler;","import DiacriticSetInterface from '../interfaces/diacritic-set.interface';\nimport DiacriticValidatorSetInterface from '../interfaces/diacritic-validator-set.interface';\nimport DiacriticMapperInterface from '../interfaces/diacritic-mapper.interface';\nimport DiacriticMatcherHandler from './diacritic-matcher-handler.class';\nimport DiacriticInsensitiveMatcherHandler from './diacritic-insensitive-matcher-handler.class';\nimport DiacriticValidatorHandler from './diacritic-validator-handler.class';\nimport DiacriticInsensitiveValidatorHandler from './diacritic-insensitive-validator-handler.class';\nimport { isString } from 'util';\n\nclass DiacriticMapperCore implements DiacriticMapperInterface {\n\n [key:string]: string|any;\n\n public dictionary: DiacriticSetInterface;\n public matcher: DiacriticSetInterface;\n\n public insensitiveMatcher: DiacriticSetInterface;\n\n public validator: DiacriticValidatorSetInterface;\n\n public insensitiveValidator: DiacriticValidatorSetInterface;\n\n public constructor(dictionaries: DiacriticSetInterface[]) {\n const dictionary = dictionaries.reduce((accumulator: DiacriticSetInterface, currentDict: DiacriticSetInterface) => {\n Object.entries(currentDict).forEach(([letter, diacritics]) => {\n if (isString(diacritics)){\n if (letter in accumulator) {\n const newDiacritics = diacritics.split('').filter(l => !accumulator[letter].includes(l)).join('');\n accumulator[letter] += newDiacritics;\n } else {\n accumulator[letter] = diacritics;\n }\n }\n });\n return accumulator;\n }, {});\n\n this.dictionary = Object.freeze(dictionary);\n this.matcher = new Proxy(this, new DiacriticMatcherHandler());\n this.insensitiveMatcher = new Proxy(this, new DiacriticInsensitiveMatcherHandler());\n this.validator = new Proxy(this, new DiacriticValidatorHandler());\n this.insensitiveValidator = new Proxy(this, new DiacriticInsensitiveValidatorHandler());\n }\n\n public matcherBy(regexp: RegExp): string {\n const lowerCase = Object.entries(this.dictionary)\n .filter(([key, value]) => value && regexp.test(key))\n .map(([,value]) => value);\n\n const upperCase = Object.entries(this.dictionary)\n .filter(([key, value]) => value && regexp.test(key.toUpperCase()))\n .map(([,value]) => value.toUpperCase());\n\n return [...lowerCase, ...upperCase].join('');\n }\n\n public replace(text: string): string {\n return text.replace(/./g, (char: string) => this[char]);\n }\n\n /**\n * Check if the given string is uppercase\n *\n * @param {string} [text=''] string to check\n * @returns {boolean} true if text is uppercase\n * @memberof DiacriticMapperCore\n */\n public isUpperCase(text: string = ''): boolean {\n return text.toUpperCase() === text;\n }\n\n /**\n * Check if the given string is lowercase\n *\n * @param {string} [text=''] string to check\n * @returns {boolean} true if text is lowercase\n * @memberof DiacriticMapperCore\n */\n public isLowerCase(text: string = ''): boolean {\n return text.toLowerCase() === text;\n }\n}\n\nexport default DiacriticMapperCore;","/**\n * i18n jsons and i18n-all.ts use material from Wikipedia\n * Article: https://en.wikipedia.org/wiki/Diacritic\n * License: CC-BY-SA 3.0\n */\nexport default {\n \"a\": \"áäâàåÄąāãă\",\n \"e\": \"éèêëěÊęėēё\",\n \"i\": \"íîïi̇řìįī\",\n \"o\": \"óôöòøōõơ\",\n \"u\": \"úûüùůŭųūư\",\n \"y\": \"ýÿŷỳ\",\n \"n\": \"ñňŋņń\",\n \"l\": \"ḷŀłļĺľ\",\n \"h\": \"ḥĥȟħ\",\n \"c\": \"çčćĉĊ\",\n \"g\": \"ğĝǧģĠġ\",\n \"s\": \"şšŝṣșſś\",\n \"у\": \"ў\",\n \"и\": \"йѝ\",\n \"е\": \"ё\",\n \"d\": \"đďðḏ\",\n \"z\": \"žŻźż\",\n \"t\": \"ťțțṭ\",\n \"w\": \"ẅŵẃẁ\",\n \"ae\": \"æ\",\n \"ss\": \"ß\",\n \"α\": \"ά\",\n \"ε\": \"έ\",\n \"η\": \"ή\",\n \"ι\": \"ίΐϊ\",\n \"ο\": \"ό\",\n \"υ\": \"ύΰϋ\",\n \"ω\": \"ώ\",\n \"j\": \"ĵ\",\n \"oe\": \"œ\",\n \"\": \"ʰ'ʼ·׳\",\n \"ii\": \"î\",\n \"k\": \"ķ\",\n \"к\": \"ќ\",\n \"г\": \"ѓґ\",\n \"ij\": \"ij\",\n \"r\": \"ŕ\",\n \"і\": \"ї\"\n};","import DiacriticRemoverHandler from './diacritic-remover-handler.class';\nimport DiacriticSetInterface from '../interfaces/diacritic-set.interface';\nimport DiacriticMapperCore from './diacritic-mapper-core.class';\n\nimport I18N_ALL from '../i18n/i18n-all.const';\n\nclass DiacriticRemover extends DiacriticMapperCore{\n [letter: string]: string|any;\n constructor(...dictionaries: DiacriticSetInterface[]) {\n super(dictionaries.length ? dictionaries : [I18N_ALL as DiacriticSetInterface]);\n Object.defineProperty(this, 'dictionary', {\n enumerable: false,\n configurable: false\n });\n return new Proxy(this, new DiacriticRemoverHandler());\n }\n}\nexport default DiacriticRemover;"],"names":["extendStatics","d","b","Object","setPrototypeOf","__proto__","Array","p","hasOwnProperty","__extends","__","this","constructor","prototype","create","isString","arg","DiacriticAbstractHandler","target","prop","receiver","length","diacriticTrap","Reflect","get","has","char","DiacriticRemoverHandler","_super","upperCase","isUpperCase","lowerCaseChar","toLowerCase","plainChar","keys","dictionary","find","c","includes","toUpperCase","DiacriticMatcherHandler","diacritics","DiacriticInsensitiveMatcherHandler","DiacriticValidatorHandler","matchingDiacritics","RegExp","DiacriticInsensitiveValidatorHandler","insensitiveMatcher","dictionaries","reduce","accumulator","currentDict","entries","forEach","_a","letter","newDiacritics","split","filter","l","join","freeze","matcher","Proxy","validator","insensitiveValidator","DiacriticMapperCore","regexp","s","i","il","arguments","r","k","a","j","jl","__spreadArrays","key","test","map","text","replace","_this","e","o","u","y","n","h","g","у","и","е","z","t","w","ae","ss","α","ε","η","ι","ο","υ","ω","oe","ii","к","г","ij","і","_i","I18N_ALL","defineProperty","enumerable","configurable"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;oFAgBA,IAAIA,EAAgB,SAASC,EAAGC,GAI5B,OAHAF,EAAgBG,OAAOC,gBAClB,CAAEC,UAAW,cAAgBC,OAAS,SAAUL,EAAGC,GAAKD,EAAEI,UAAYH,IACvE,SAAUD,EAAGC,GAAK,IAAK,IAAIK,KAAKL,EAAOA,EAAEM,eAAeD,KAAIN,EAAEM,GAAKL,EAAEK,MACpDN,EAAGC,IAGrB,SAASO,EAAUR,EAAGC,GAEzB,SAASQ,IAAOC,KAAKC,YAAcX,EADnCD,EAAcC,EAAGC,GAEjBD,EAAEY,UAAkB,OAANX,EAAaC,OAAOW,OAAOZ,IAAMQ,EAAGG,UAAYX,EAAEW,UAAW,IAAIH,GCyb5E,SAASK,EAASC,GACvB,MAAsB,iBAARA,ECjdhB,iBAAA,cAeA,OAdIC,gBAAA,SAAIC,EAAkCC,EAAmBC,GACrD,OAAIL,EAASI,IAAyB,IAAhBA,EAAKE,OAChBV,KAAKW,cAAcJ,EAAQC,GAE/BI,QAAQC,IAAIN,EAAQC,EAAMC,IAGrCH,gBAAA,SAAIC,EAAkCC,GAClC,OAAQJ,EAASI,IAAyB,IAAhBA,EAAKE,QAAiBE,QAAQE,IAAIP,EAAQC,IAG9DF,0BAAV,SAAwBC,EAAkCQ,wBCX9D,4DAaA,OAbsCjB,OACxBkB,0BAAV,SAAwBT,EAAkCQ,GACtDE,YAAMN,wBAAcJ,EAAQQ,GAC5B,IAAMG,EAAqBX,EAA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,gBAAkB0C,GAU3Bf,wBAAP,SAAmBe,GACf,oBADeA,MACRA,EAAKjD,gBAAkBiD,UC1EvB,CACXP,EAAK,aACLU,EAAK,aACLf,EAAK,YACLgB,EAAK,WACLC,EAAK,YACLC,EAAK,OACLC,EAAK,QACL7B,EAAK,SACL8B,EAAK,OACLpD,EAAK,QACLqD,EAAK,SACLtB,EAAK,UACLuB,IAAK,IACLC,IAAK,KACLC,IAAK,IACL5F,EAAK,OACL6F,EAAK,OACLC,EAAK,OACLC,EAAK,OACLC,GAAM,IACNC,GAAM,IACNC,IAAK,IACLC,IAAK,IACLC,IAAK,IACLC,IAAK,MACLC,IAAK,IACLC,IAAK,MACLC,IAAK,IACL9B,EAAK,IACL+B,GAAM,IACN,GAAI,QACJC,GAAM,IACNlC,EAAK,IACLmC,IAAK,IACLC,IAAK,KACLC,GAAM,IACNtC,EAAK,IACLuC,IAAK,wBCnCL,iBAAY,aAAAC,mBAAAA,IAAAhE,kBAAZ,MACIpB,YAAMoB,EAAa3B,OAAS2B,EAAe,CAACiE,UAK5C,OAJA9G,OAAO+G,eAAe/B,EAAM,aAAc,CACtCgC,YAAY,EACZC,cAAc,IAEX,IAAIrD,MAAMoB,EAAM,IAAIxD,GAEnC,OAV+BlB,UAAAyD"} \ No newline at end of file +{"version":3,"file":"diacritic-remover.bundle.js","sources":["../node_modules/rollup-plugin-node-builtins/src/es6/util.js","../src/classes/diacritic-abstract-handler.class.ts","../src/classes/diacritic-remover-handler.class.ts","../src/classes/diacritic-matcher-handler.class.ts","../src/classes/diacritic-insensitive-matcher-handler.class.ts","../src/classes/diacritic-validator-handler.class.ts","../src/classes/diacritic-insensitive-validator-handler.class.ts","../src/classes/diacritic-mapper-core.class.ts","../src/i18n/i18n-all.const.ts","../src/classes/diacritic-remover.class.ts"],"sourcesContent":["// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\nimport process from 'process';\nvar formatRegExp = /%[sdj%]/g;\nexport function format(f) {\n if (!isString(f)) {\n var objects = [];\n for (var i = 0; i < arguments.length; i++) {\n objects.push(inspect(arguments[i]));\n }\n return objects.join(' ');\n }\n\n var i = 1;\n var args = arguments;\n var len = args.length;\n var str = String(f).replace(formatRegExp, function(x) {\n if (x === '%%') return '%';\n if (i >= len) return x;\n switch (x) {\n case '%s': return String(args[i++]);\n case '%d': return Number(args[i++]);\n case '%j':\n try {\n return JSON.stringify(args[i++]);\n } catch (_) {\n return '[Circular]';\n }\n default:\n return x;\n }\n });\n for (var x = args[i]; i < len; x = args[++i]) {\n if (isNull(x) || !isObject(x)) {\n str += ' ' + x;\n } else {\n str += ' ' + inspect(x);\n }\n }\n return str;\n};\n\n\n// Mark that a method should not be used.\n// Returns a modified function which warns once by default.\n// If --no-deprecation is set, then it is a no-op.\nexport function deprecate(fn, msg) {\n // Allow for deprecating things in the process of starting up.\n if (isUndefined(global.process)) {\n return function() {\n return deprecate(fn, msg).apply(this, arguments);\n };\n }\n\n if (process.noDeprecation === true) {\n return fn;\n }\n\n var warned = false;\n function deprecated() {\n if (!warned) {\n if (process.throwDeprecation) {\n throw new Error(msg);\n } else if (process.traceDeprecation) {\n console.trace(msg);\n } else {\n console.error(msg);\n }\n warned = true;\n }\n return fn.apply(this, arguments);\n }\n\n return deprecated;\n};\n\n\nvar debugs = {};\nvar debugEnviron;\nexport function debuglog(set) {\n if (isUndefined(debugEnviron))\n debugEnviron = process.env.NODE_DEBUG || '';\n set = set.toUpperCase();\n if (!debugs[set]) {\n if (new RegExp('\\\\b' + set + '\\\\b', 'i').test(debugEnviron)) {\n var pid = 0;\n debugs[set] = function() {\n var msg = format.apply(null, arguments);\n console.error('%s %d: %s', set, pid, msg);\n };\n } else {\n debugs[set] = function() {};\n }\n }\n return debugs[set];\n};\n\n\n/**\n * Echos the value of a value. Trys to print the value out\n * in the best way possible given the different types.\n *\n * @param {Object} obj The object to print out.\n * @param {Object} opts Optional options object that alters the output.\n */\n/* legacy: obj, showHidden, depth, colors*/\nexport function inspect(obj, opts) {\n // default options\n var ctx = {\n seen: [],\n stylize: stylizeNoColor\n };\n // legacy...\n if (arguments.length >= 3) ctx.depth = arguments[2];\n if (arguments.length >= 4) ctx.colors = arguments[3];\n if (isBoolean(opts)) {\n // legacy...\n ctx.showHidden = opts;\n } else if (opts) {\n // got an \"options\" object\n _extend(ctx, opts);\n }\n // set default options\n if (isUndefined(ctx.showHidden)) ctx.showHidden = false;\n if (isUndefined(ctx.depth)) ctx.depth = 2;\n if (isUndefined(ctx.colors)) ctx.colors = false;\n if (isUndefined(ctx.customInspect)) ctx.customInspect = true;\n if (ctx.colors) ctx.stylize = stylizeWithColor;\n return formatValue(ctx, obj, ctx.depth);\n}\n\n// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics\ninspect.colors = {\n 'bold' : [1, 22],\n 'italic' : [3, 23],\n 'underline' : [4, 24],\n 'inverse' : [7, 27],\n 'white' : [37, 39],\n 'grey' : [90, 39],\n 'black' : [30, 39],\n 'blue' : [34, 39],\n 'cyan' : [36, 39],\n 'green' : [32, 39],\n 'magenta' : [35, 39],\n 'red' : [31, 39],\n 'yellow' : [33, 39]\n};\n\n// Don't use 'blue' not visible on cmd.exe\ninspect.styles = {\n 'special': 'cyan',\n 'number': 'yellow',\n 'boolean': 'yellow',\n 'undefined': 'grey',\n 'null': 'bold',\n 'string': 'green',\n 'date': 'magenta',\n // \"name\": intentionally not styling\n 'regexp': 'red'\n};\n\n\nfunction stylizeWithColor(str, styleType) {\n var style = inspect.styles[styleType];\n\n if (style) {\n return '\\u001b[' + inspect.colors[style][0] + 'm' + str +\n '\\u001b[' + inspect.colors[style][1] + 'm';\n } else {\n return str;\n }\n}\n\n\nfunction stylizeNoColor(str, styleType) {\n return str;\n}\n\n\nfunction arrayToHash(array) {\n var hash = {};\n\n array.forEach(function(val, idx) {\n hash[val] = true;\n });\n\n return hash;\n}\n\n\nfunction formatValue(ctx, value, recurseTimes) {\n // Provide a hook for user-specified inspect functions.\n // Check that value is an object with an inspect function on it\n if (ctx.customInspect &&\n value &&\n isFunction(value.inspect) &&\n // Filter out the util module, it's inspect function is special\n value.inspect !== inspect &&\n // Also filter out any prototype objects using the circular check.\n !(value.constructor && value.constructor.prototype === value)) {\n var ret = value.inspect(recurseTimes, ctx);\n if (!isString(ret)) {\n ret = formatValue(ctx, ret, recurseTimes);\n }\n return ret;\n }\n\n // Primitive types cannot have properties\n var primitive = formatPrimitive(ctx, value);\n if (primitive) {\n return primitive;\n }\n\n // Look up the keys of the object.\n var keys = Object.keys(value);\n var visibleKeys = arrayToHash(keys);\n\n if (ctx.showHidden) {\n keys = Object.getOwnPropertyNames(value);\n }\n\n // IE doesn't make error fields non-enumerable\n // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx\n if (isError(value)\n && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {\n return formatError(value);\n }\n\n // Some type of object without properties can be shortcutted.\n if (keys.length === 0) {\n if (isFunction(value)) {\n var name = value.name ? ': ' + value.name : '';\n return ctx.stylize('[Function' + name + ']', 'special');\n }\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n }\n if (isDate(value)) {\n return ctx.stylize(Date.prototype.toString.call(value), 'date');\n }\n if (isError(value)) {\n return formatError(value);\n }\n }\n\n var base = '', array = false, braces = ['{', '}'];\n\n // Make Array say that they are Array\n if (isArray(value)) {\n array = true;\n braces = ['[', ']'];\n }\n\n // Make functions say that they are functions\n if (isFunction(value)) {\n var n = value.name ? ': ' + value.name : '';\n base = ' [Function' + n + ']';\n }\n\n // Make RegExps say that they are RegExps\n if (isRegExp(value)) {\n base = ' ' + RegExp.prototype.toString.call(value);\n }\n\n // Make dates with properties first say the date\n if (isDate(value)) {\n base = ' ' + Date.prototype.toUTCString.call(value);\n }\n\n // Make error with message first say the error\n if (isError(value)) {\n base = ' ' + formatError(value);\n }\n\n if (keys.length === 0 && (!array || value.length == 0)) {\n return braces[0] + base + braces[1];\n }\n\n if (recurseTimes < 0) {\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n } else {\n return ctx.stylize('[Object]', 'special');\n }\n }\n\n ctx.seen.push(value);\n\n var output;\n if (array) {\n output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);\n } else {\n output = keys.map(function(key) {\n return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);\n });\n }\n\n ctx.seen.pop();\n\n return reduceToSingleString(output, base, braces);\n}\n\n\nfunction formatPrimitive(ctx, value) {\n if (isUndefined(value))\n return ctx.stylize('undefined', 'undefined');\n if (isString(value)) {\n var simple = '\\'' + JSON.stringify(value).replace(/^\"|\"$/g, '')\n .replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"') + '\\'';\n return ctx.stylize(simple, 'string');\n }\n if (isNumber(value))\n return ctx.stylize('' + value, 'number');\n if (isBoolean(value))\n return ctx.stylize('' + value, 'boolean');\n // For some reason typeof null is \"object\", so special case here.\n if (isNull(value))\n return ctx.stylize('null', 'null');\n}\n\n\nfunction formatError(value) {\n return '[' + Error.prototype.toString.call(value) + ']';\n}\n\n\nfunction formatArray(ctx, value, recurseTimes, visibleKeys, keys) {\n var output = [];\n for (var i = 0, l = value.length; i < l; ++i) {\n if (hasOwnProperty(value, String(i))) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n String(i), true));\n } else {\n output.push('');\n }\n }\n keys.forEach(function(key) {\n if (!key.match(/^\\d+$/)) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n key, true));\n }\n });\n return output;\n}\n\n\nfunction formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {\n var name, str, desc;\n desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };\n if (desc.get) {\n if (desc.set) {\n str = ctx.stylize('[Getter/Setter]', 'special');\n } else {\n str = ctx.stylize('[Getter]', 'special');\n }\n } else {\n if (desc.set) {\n str = ctx.stylize('[Setter]', 'special');\n }\n }\n if (!hasOwnProperty(visibleKeys, key)) {\n name = '[' + key + ']';\n }\n if (!str) {\n if (ctx.seen.indexOf(desc.value) < 0) {\n if (isNull(recurseTimes)) {\n str = formatValue(ctx, desc.value, null);\n } else {\n str = formatValue(ctx, desc.value, recurseTimes - 1);\n }\n if (str.indexOf('\\n') > -1) {\n if (array) {\n str = str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n').substr(2);\n } else {\n str = '\\n' + str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n');\n }\n }\n } else {\n str = ctx.stylize('[Circular]', 'special');\n }\n }\n if (isUndefined(name)) {\n if (array && key.match(/^\\d+$/)) {\n return str;\n }\n name = JSON.stringify('' + key);\n if (name.match(/^\"([a-zA-Z_][a-zA-Z_0-9]*)\"$/)) {\n name = name.substr(1, name.length - 2);\n name = ctx.stylize(name, 'name');\n } else {\n name = name.replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"')\n .replace(/(^\"|\"$)/g, \"'\");\n name = ctx.stylize(name, 'string');\n }\n }\n\n return name + ': ' + str;\n}\n\n\nfunction reduceToSingleString(output, base, braces) {\n var numLinesEst = 0;\n var length = output.reduce(function(prev, cur) {\n numLinesEst++;\n if (cur.indexOf('\\n') >= 0) numLinesEst++;\n return prev + cur.replace(/\\u001b\\[\\d\\d?m/g, '').length + 1;\n }, 0);\n\n if (length > 60) {\n return braces[0] +\n (base === '' ? '' : base + '\\n ') +\n ' ' +\n output.join(',\\n ') +\n ' ' +\n braces[1];\n }\n\n return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];\n}\n\n\n// NOTE: These type checking functions intentionally don't use `instanceof`\n// because it is fragile and can be easily faked with `Object.create()`.\nexport function isArray(ar) {\n return Array.isArray(ar);\n}\n\nexport function isBoolean(arg) {\n return typeof arg === 'boolean';\n}\n\nexport function isNull(arg) {\n return arg === null;\n}\n\nexport function isNullOrUndefined(arg) {\n return arg == null;\n}\n\nexport function isNumber(arg) {\n return typeof arg === 'number';\n}\n\nexport function isString(arg) {\n return typeof arg === 'string';\n}\n\nexport function isSymbol(arg) {\n return typeof arg === 'symbol';\n}\n\nexport function isUndefined(arg) {\n return arg === void 0;\n}\n\nexport function isRegExp(re) {\n return isObject(re) && objectToString(re) === '[object RegExp]';\n}\n\nexport function isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\n\nexport function isDate(d) {\n return isObject(d) && objectToString(d) === '[object Date]';\n}\n\nexport function isError(e) {\n return isObject(e) &&\n (objectToString(e) === '[object Error]' || e instanceof Error);\n}\n\nexport function isFunction(arg) {\n return typeof arg === 'function';\n}\n\nexport function isPrimitive(arg) {\n return arg === null ||\n typeof arg === 'boolean' ||\n typeof arg === 'number' ||\n typeof arg === 'string' ||\n typeof arg === 'symbol' || // ES6 symbol\n typeof arg === 'undefined';\n}\n\nexport function isBuffer(maybeBuf) {\n return Buffer.isBuffer(maybeBuf);\n}\n\nfunction objectToString(o) {\n return Object.prototype.toString.call(o);\n}\n\n\nfunction pad(n) {\n return n < 10 ? '0' + n.toString(10) : n.toString(10);\n}\n\n\nvar months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',\n 'Oct', 'Nov', 'Dec'];\n\n// 26 Feb 16:19:34\nfunction timestamp() {\n var d = new Date();\n var time = [pad(d.getHours()),\n pad(d.getMinutes()),\n pad(d.getSeconds())].join(':');\n return [d.getDate(), months[d.getMonth()], time].join(' ');\n}\n\n\n// log is just a thin wrapper to console.log that prepends a timestamp\nexport function log() {\n console.log('%s - %s', timestamp(), format.apply(null, arguments));\n}\n\n\n/**\n * Inherit the prototype methods from one constructor into another.\n *\n * The Function.prototype.inherits from lang.js rewritten as a standalone\n * function (not on Function.prototype). NOTE: If this file is to be loaded\n * during bootstrapping this function needs to be rewritten using some native\n * functions as prototype setup using normal JavaScript does not work as\n * expected during bootstrapping (see mirror.js in r114903).\n *\n * @param {function} ctor Constructor function which needs to inherit the\n * prototype.\n * @param {function} superCtor Constructor function to inherit prototype from.\n */\nimport inherits from './inherits';\nexport {inherits}\n\nexport function _extend(origin, add) {\n // Don't do anything if add isn't an object\n if (!add || !isObject(add)) return origin;\n\n var keys = Object.keys(add);\n var i = keys.length;\n while (i--) {\n origin[keys[i]] = add[keys[i]];\n }\n return origin;\n};\n\nfunction hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\nexport default {\n inherits: inherits,\n _extend: _extend,\n log: log,\n isBuffer: isBuffer,\n isPrimitive: isPrimitive,\n isFunction: isFunction,\n isError: isError,\n isDate: isDate,\n isObject: isObject,\n isRegExp: isRegExp,\n isUndefined: isUndefined,\n isSymbol: isSymbol,\n isString: isString,\n isNumber: isNumber,\n isNullOrUndefined: isNullOrUndefined,\n isNull: isNull,\n isBoolean: isBoolean,\n isArray: isArray,\n inspect: inspect,\n deprecate: deprecate,\n format: format,\n debuglog: debuglog\n}\n","import { isString } from \"util\";\nimport DiacriticMapperInterface from '../interfaces/diacritic-mapper.interface';\n\nabstract class DiacriticAbstractHandler implements ProxyHandler {\n get(target: DiacriticMapperInterface, prop: PropertyKey, receiver: any): any {\n if (isString(prop) && prop.length <= 1) {\n return this.diacriticTrap(target, prop);\n }\n return Reflect.get(target, prop, receiver);\n }\n\n protected diacriticTrap(target: DiacriticMapperInterface, char: string): any {\n return char;\n }\n}\n\nexport default DiacriticAbstractHandler;","import DiacriticMapperInterface from '../interfaces/diacritic-mapper.interface';\nimport DiacriticAbstractHandler from './diacritic-abstract-handler.class';\nimport { isString } from 'util';\n\nclass DiacriticRemoverHandler extends DiacriticAbstractHandler {\n protected diacriticTrap(target: DiacriticMapperInterface, char: string): string {\n super.diacriticTrap(target, char);\n const upperCase: boolean = target.isUpperCase(char);\n const lowerCaseChar = char.toLowerCase();\n\n const [plainChar] = Object.entries(target.dictionary)\n .find(([, diacritics]) => isString(diacritics) && diacritics.includes(lowerCaseChar)) || [];\n if (upperCase && plainChar) {\n return plainChar.toUpperCase();\n }\n return isString(plainChar) ? plainChar : char;\n }\n}\n\nexport default DiacriticRemoverHandler;","import DiacriticAbstractHandler from './diacritic-abstract-handler.class';\nimport DiacriticMapperInterface from '../interfaces/diacritic-mapper.interface';\n\nclass DiacriticMatcherHandler extends DiacriticAbstractHandler {\n protected diacriticTrap(target: DiacriticMapperInterface, char: string): string {\n let matcher = super.diacriticTrap(target, char);\n\n const diacritics = target.dictionary[char.toLowerCase()];\n if (diacritics) {\n matcher+= target.isUpperCase(matcher) ? diacritics.toUpperCase() : diacritics;\n }\n return matcher;\n }\n}\n\nexport default DiacriticMatcherHandler;","import DiacriticAbstractHandler from './diacritic-abstract-handler.class';\nimport DiacriticMapperInterface from '../interfaces/diacritic-mapper.interface';\n\nclass DiacriticInsensitiveMatcherHandler extends DiacriticAbstractHandler {\n protected diacriticTrap(target: DiacriticMapperInterface, char: string): string {\n const lowerCaseChar = super.diacriticTrap(target, char).toLowerCase();\n const insensitiveMatcher = new Set([lowerCaseChar, lowerCaseChar.toUpperCase()]);\n const diacritics = target.dictionary[lowerCaseChar] || '';\n [...diacritics]\n .forEach(diacritic => {\n insensitiveMatcher.add(diacritic);\n insensitiveMatcher.add(diacritic.toUpperCase());\n });\n\n return [...insensitiveMatcher].sort().join('');\n }\n}\n\nexport default DiacriticInsensitiveMatcherHandler;","import DiacriticAbstractHandler from './diacritic-abstract-handler.class';\nimport DiacriticMapperInterface from '../interfaces/diacritic-mapper.interface';\n\nclass DiacriticValidatorHandler extends DiacriticAbstractHandler {\n protected diacriticTrap(target: DiacriticMapperInterface, char: string): RegExp {\n super.diacriticTrap(target, char);\n const diacritics = target.dictionary[char.toLowerCase()];\n let matchingDiacritics = '';\n if (diacritics) {\n matchingDiacritics = target.isUpperCase(char) ? diacritics.toUpperCase() : diacritics;\n }\n return new RegExp(`[${char}${matchingDiacritics}]`, 'u');\n }\n}\n\nexport default DiacriticValidatorHandler;","import DiacriticAbstractHandler from './diacritic-abstract-handler.class';\nimport DiacriticMapperInterface from '../interfaces/diacritic-mapper.interface';\n\nclass DiacriticInsensitiveValidatorHandler extends DiacriticAbstractHandler {\n protected diacriticTrap(target: DiacriticMapperInterface, char: string): RegExp {\n super.diacriticTrap(target, char);\n return new RegExp(`[${char}${target.insensitiveMatcher[char] || ''}]`, 'ui');\n }\n}\n\nexport default DiacriticInsensitiveValidatorHandler;","import DiacriticSetInterface from '../interfaces/diacritic-set.interface';\nimport DiacriticValidatorSetInterface from '../interfaces/diacritic-validator-set.interface';\nimport DiacriticMapperInterface from '../interfaces/diacritic-mapper.interface';\nimport DiacriticMatcherHandler from './diacritic-matcher-handler.class';\nimport DiacriticInsensitiveMatcherHandler from './diacritic-insensitive-matcher-handler.class';\nimport DiacriticValidatorHandler from './diacritic-validator-handler.class';\nimport DiacriticInsensitiveValidatorHandler from './diacritic-insensitive-validator-handler.class';\nimport { isString } from 'util';\n\nclass DiacriticMapperCore implements DiacriticMapperInterface {\n\n [key:string]: string|any;\n\n public dictionary: DiacriticSetInterface;\n public matcher: DiacriticSetInterface;\n\n public insensitiveMatcher: DiacriticSetInterface;\n\n public validator: DiacriticValidatorSetInterface;\n\n public insensitiveValidator: DiacriticValidatorSetInterface;\n\n public constructor(dictionaries: DiacriticSetInterface[]) {\n const dictionary = dictionaries\n .reduce((\n dictMerge: DiacriticSetInterface,\n currentDict: DiacriticSetInterface\n ) => Object.entries(currentDict)\n .reduce((accumulator: DiacriticSetInterface, [letter, diacritics]) => ({\n ...accumulator,\n [letter]: (accumulator[letter] || '') + diacritics\n }), dictMerge),\n {});\n\n Object.entries(dictionary)\n .forEach(([letter, diacritics]) => {\n dictionary[letter] = [...(new Set([...diacritics]))].sort().join('');\n });\n\n this.dictionary = Object.freeze(dictionary);\n this.matcher = new Proxy(this, new DiacriticMatcherHandler());\n this.insensitiveMatcher = new Proxy(this, new DiacriticInsensitiveMatcherHandler());\n this.validator = new Proxy(this, new DiacriticValidatorHandler());\n this.insensitiveValidator = new Proxy(this, new DiacriticInsensitiveValidatorHandler());\n }\n\n public matcherBy(regexp: RegExp): string {\n const lowerCase = Object.entries(this.dictionary)\n .filter(([key, value]) => value && regexp.test(key))\n .map(([char ,value]) => char + value);\n\n const upperCase = Object.entries(this.dictionary)\n .filter(([key, value]) => value && regexp.test(key.toUpperCase()))\n .map(([char ,value]) => (char + value).toUpperCase());\n\n return [...lowerCase, ...upperCase].join('');\n }\n\n public replace(text: string): string {\n return text.replace(/./g, (char: string) => this[char]);\n }\n\n /**\n * Check if the given string is uppercase\n *\n * @param {string} [text=''] string to check\n * @returns {boolean} true if text is uppercase\n * @memberof DiacriticMapperCore\n */\n public isUpperCase(text: string = ''): boolean {\n return text.toUpperCase() === text;\n }\n\n /**\n * Check if the given string is lowercase\n *\n * @param {string} [text=''] string to check\n * @returns {boolean} true if text is lowercase\n * @memberof DiacriticMapperCore\n */\n public isLowerCase(text: string = ''): boolean {\n return text.toLowerCase() === text;\n }\n}\n\nexport default DiacriticMapperCore;","/**\n * i18n jsons and i18n-all.ts use material from Wikipedia\n * Article: https://en.wikipedia.org/wiki/Diacritic\n * License: CC-BY-SA 3.0\n */\nexport default {\n \"a\": \"áäâàåÄąāãă\",\n \"e\": \"éèêëěÊęėēё\",\n \"i\": \"íîïi̇řìįī\",\n \"o\": \"óôöòøōõơ\",\n \"u\": \"úûüùůŭųūư\",\n \"y\": \"ýÿŷỳ\",\n \"n\": \"ñňŋņń\",\n \"l\": \"ḷŀłļĺľ\",\n \"h\": \"ḥĥȟħ\",\n \"c\": \"çčćĉĊ\",\n \"g\": \"ğĝǧģĠġ\",\n \"s\": \"şšŝṣșſś\",\n \"у\": \"ў\",\n \"и\": \"йѝ\",\n \"е\": \"ё\",\n \"d\": \"đďðḏ\",\n \"z\": \"žŻźż\",\n \"t\": \"ťțțṭ\",\n \"w\": \"ẅŵẃẁ\",\n \"ae\": \"æ\",\n \"ss\": \"ß\",\n \"α\": \"ά\",\n \"ε\": \"έ\",\n \"η\": \"ή\",\n \"ι\": \"ίΐϊ\",\n \"ο\": \"ό\",\n \"υ\": \"ύΰϋ\",\n \"ω\": \"ώ\",\n \"j\": \"ĵ\",\n \"oe\": \"œ\",\n \"\": \"ʰ'ʼ·׳\",\n \"ii\": \"î\",\n \"k\": \"ķ\",\n \"к\": \"ќ\",\n \"г\": \"ѓґ\",\n \"ij\": \"ij\",\n \"r\": \"ŕ\",\n \"і\": \"ї\"\n};","import DiacriticRemoverHandler from './diacritic-remover-handler.class';\nimport DiacriticSetInterface from '../interfaces/diacritic-set.interface';\nimport DiacriticMapperCore from './diacritic-mapper-core.class';\n\nimport I18N_ALL from '../i18n/i18n-all.const';\n\nclass DiacriticRemover extends DiacriticMapperCore {\n [letter: string]: string|any;\n constructor(...dictionaries: DiacriticSetInterface[]) {\n super(dictionaries.length ? dictionaries : [I18N_ALL as DiacriticSetInterface]);\n Object.defineProperty(this, 'dictionary', {\n enumerable: false,\n configurable: false\n });\n return new Proxy(this, new DiacriticRemoverHandler());\n }\n}\nexport default DiacriticRemover;"],"names":["isString","arg","DiacriticAbstractHandler","[object Object]","target","prop","receiver","length","this","diacriticTrap","Reflect","get","char","DiacriticRemoverHandler","super","upperCase","isUpperCase","lowerCaseChar","toLowerCase","plainChar","Object","entries","dictionary","find","diacritics","includes","toUpperCase","DiacriticMatcherHandler","matcher","DiacriticInsensitiveMatcherHandler","insensitiveMatcher","Set","forEach","diacritic","add","sort","join","DiacriticValidatorHandler","matchingDiacritics","RegExp","DiacriticInsensitiveValidatorHandler","DiacriticMapperCore","dictionaries","reduce","dictMerge","currentDict","accumulator","letter","freeze","Proxy","validator","insensitiveValidator","regexp","filter","key","value","test","map","text","replace","a","e","i","o","u","y","n","l","h","c","g","s","у","и","е","d","z","t","w","ae","ss","α","ε","η","ι","ο","υ","ω","j","oe","ii","k","к","г","ij","r","і","I18N_ALL","defineProperty","enumerable","configurable"],"mappings":";;;;;;;;;4CAmdO,SAASA,EAASC,GACvB,MAAsB,iBAARA,ECjdhB,MAAeC,EACXC,IAAIC,EAAkCC,EAAmBC,GACrD,OAAIN,EAASK,IAASA,EAAKE,QAAU,EAC1BC,KAAKC,cAAcL,EAAQC,GAE/BK,QAAQC,IAAIP,EAAQC,EAAMC,GAG3BH,cAAcC,EAAkCQ,GACtD,OAAOA,GCRf,MAAMC,UAAgCX,EACxBC,cAAcC,EAAkCQ,GACtDE,MAAML,cAAcL,EAAQQ,GAC5B,MAAMG,EAAqBX,EAAOY,YAAYJ,GACxCK,EAAgBL,EAAKM,eAEpBC,GAAaC,OAAOC,QAAQjB,EAAOkB,YACrCC,KAAK,GAAIC,KAAgBxB,EAASwB,IAAeA,EAAWC,SAASR,KAAmB,GAC7F,OAAIF,GAAaI,EACNA,EAAUO,cAEd1B,EAASmB,GAAaA,EAAYP,GCZjD,MAAMe,UAAgCzB,EACxBC,cAAcC,EAAkCQ,GACtD,IAAIgB,EAAUd,MAAML,cAAcL,EAAQQ,GAE1C,MAAMY,EAAapB,EAAOkB,WAAWV,EAAKM,eAI1C,OAHIM,IACAI,GAAUxB,EAAOY,YAAYY,GAAW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 No newline at end of file diff --git a/dist/diacritic-remover.es.js b/dist/diacritic-remover.es.js index e909fa5..745b5e7 100644 --- a/dist/diacritic-remover.es.js +++ b/dist/diacritic-remover.es.js @@ -1,5 +1,5 @@ /** - * @marketto/diacritic-remover 1.0.2 + * @marketto/diacritic-remover 1.0.3 * Copyright (c) 2019, Marco Ricupero * License: MIT * ============================================================ @@ -7,19 +7,5 @@ * Article: https://en.wikipedia.org/wiki/Diacritic * License: CC-BY-SA 3.0 */ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */ -var t=function(r,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var n in r)r.hasOwnProperty(n)&&(t[n]=r[n])})(r,n)};function r(r,n){function e(){this.constructor=r}t(r,n),r.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}function n(t){return"string"==typeof t}var e=function(){function t(){}return t.prototype.get=function(t,r,e){return n(r)&&1===r.length?this.diacriticTrap(t,r):Reflect.get(t,r,e)},t.prototype.has=function(t,r){return n(r)&&1===r.length||Reflect.has(t,r)},t.prototype.diacriticTrap=function(t,r){},t}(),i=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.diacriticTrap=function(r,e){t.prototype.diacriticTrap.call(this,r,e);var i=r.isUpperCase(e),o=e.toLowerCase(),c=Object.keys(r.dictionary).find((function(t){return n(r.dictionary[t])&&r.dictionary[t].includes(o)}));return i&&c?c.toUpperCase():c||e},e}(e),o=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return r(n,t),n.prototype.diacriticTrap=function(r,n){t.prototype.diacriticTrap.call(this,r,n);var e=r.dictionary[n.toLowerCase()];return e?r.isUpperCase(n)?e.toUpperCase():e:n},n}(e),c=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return r(n,t),n.prototype.diacriticTrap=function(r,n){t.prototype.diacriticTrap.call(this,r,n);var e=r.dictionary[n.toLowerCase()];return e?e+e.toUpperCase():n},n}(e),a=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return r(n,t),n.prototype.diacriticTrap=function(r,n){t.prototype.diacriticTrap.call(this,r,n);var e=r.dictionary[n.toLowerCase()],i="";return e&&(i=r.isUpperCase(n)?e.toUpperCase():e),new RegExp("["+n+i+"]","u")},n}(e),p=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return r(n,t),n.prototype.diacriticTrap=function(r,n){return t.prototype.diacriticTrap.call(this,r,n),new RegExp("["+n+(r.insensitiveMatcher[n]||"")+"]","ui")},n}(e),u=function(){function t(t){var r=t.reduce((function(t,r){return Object.entries(r).forEach((function(r){var e=r[0],i=r[1];if(n(i))if(e in t){var o=i.split("").filter((function(r){return!t[e].includes(r)})).join("");t[e]+=o}else t[e]=i})),t}),{});this.dictionary=Object.freeze(r),this.matcher=new Proxy(this,new o),this.insensitiveMatcher=new Proxy(this,new c),this.validator=new Proxy(this,new a),this.insensitiveValidator=new Proxy(this,new p)}return t.prototype.matcherBy=function(t){return function(){for(var t=0,r=0,n=arguments.length;re(t)&&t.includes(s))||[];return i&&a?a.toUpperCase():e(a)?a:r}}class i extends t{diacriticTrap(e,t){let r=super.diacriticTrap(e,t);const i=e.dictionary[t.toLowerCase()];return i&&(r+=e.isUpperCase(r)?i.toUpperCase():i),r}}class s extends t{diacriticTrap(e,t){const r=super.diacriticTrap(e,t).toLowerCase(),i=new Set([r,r.toUpperCase()]);return[...e.dictionary[r]||""].forEach(e=>{i.add(e),i.add(e.toUpperCase())}),[...i].sort().join("")}}class a extends t{diacriticTrap(e,t){super.diacriticTrap(e,t);const r=e.dictionary[t.toLowerCase()];let i="";return r&&(i=e.isUpperCase(t)?r.toUpperCase():r),new RegExp(`[${t}${i}]`,"u")}}class n extends t{diacriticTrap(e,t){return super.diacriticTrap(e,t),new RegExp(`[${t}${e.insensitiveMatcher[t]||""}]`,"ui")}}class c{constructor(e){const t=e.reduce((e,t)=>Object.entries(t).reduce((e,[t,r])=>Object.assign(Object.assign({},e),{[t]:(e[t]||"")+r}),e),{});Object.entries(t).forEach(([e,r])=>{t[e]=[...new Set([...r])].sort().join("")}),this.dictionary=Object.freeze(t),this.matcher=new Proxy(this,new i),this.insensitiveMatcher=new Proxy(this,new s),this.validator=new Proxy(this,new a),this.insensitiveValidator=new Proxy(this,new n)}matcherBy(e){return[...Object.entries(this.dictionary).filter(([t,r])=>r&&e.test(t)).map(([e,t])=>e+t),...Object.entries(this.dictionary).filter(([t,r])=>r&&e.test(t.toUpperCase())).map(([e,t])=>(e+t).toUpperCase())].join("")}replace(e){return e.replace(/./g,e=>this[e])}isUpperCase(e=""){return e.toUpperCase()===e}isLowerCase(e=""){return e.toLowerCase()===e}}var o={a:"áäâàåÄąāãă",e:"éèêëěÊęėēё",i:"íîïi̇řìįī",o:"óôöòøōõơ",u:"úûüùůŭųūư",y:"ýÿŷỳ",n:"ñňŋņń",l:"ḷŀłļĺľ",h:"ḥĥȟħ",c:"çčćĉĊ",g:"ğĝǧģĠġ",s:"şšŝṣșſś","у":"ў","и":"йѝ","е":"ё",d:"đďðḏ",z:"žŻźż",t:"ťțțṭ",w:"ẅŵẃẁ",ae:"æ",ss:"ß","α":"ά","ε":"έ","η":"ή","ι":"ίΐϊ","ο":"ό","υ":"ύΰϋ","ω":"ώ",j:"ĵ",oe:"œ","":"ʰ'ʼ·׳",ii:"î",k:"ķ","к":"ќ","г":"ѓґ",ij:"ij",r:"ŕ","і":"ї"};export default class extends c{constructor(...e){return super(e.length?e:[o]),Object.defineProperty(this,"dictionary",{enumerable:!1,configurable:!1}),new Proxy(this,new r)}} //# sourceMappingURL=diacritic-remover.es.js.map diff --git a/dist/diacritic-remover.es.js.map b/dist/diacritic-remover.es.js.map index 9c74929..144b0a0 100644 --- a/dist/diacritic-remover.es.js.map +++ b/dist/diacritic-remover.es.js.map @@ -1 +1 @@ -{"version":3,"file":"diacritic-remover.es.js","sources":["../node_modules/tslib/tslib.es6.js","../node_modules/rollup-plugin-node-builtins/src/es6/util.js","../src/classes/diacritic-abstract-handler.class.ts","../src/classes/diacritic-remover-handler.class.ts","../src/classes/diacritic-matcher-handler.class.ts","../src/classes/diacritic-insensitive-matcher-handler.class.ts","../src/classes/diacritic-validator-handler.class.ts","../src/classes/diacritic-insensitive-validator-handler.class.ts","../src/classes/diacritic-mapper-core.class.ts","../src/i18n/i18n-all.const.ts","../src/classes/diacritic-remover.class.ts"],"sourcesContent":["/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\r\n if (m) return m.call(o);\r\n return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\nimport process from 'process';\nvar formatRegExp = /%[sdj%]/g;\nexport function format(f) {\n if (!isString(f)) {\n var objects = [];\n for (var i = 0; i < arguments.length; i++) {\n objects.push(inspect(arguments[i]));\n }\n return objects.join(' ');\n }\n\n var i = 1;\n var args = arguments;\n var len = args.length;\n var str = String(f).replace(formatRegExp, function(x) {\n if (x === '%%') return '%';\n if (i >= len) return x;\n switch (x) {\n case '%s': return String(args[i++]);\n case '%d': return Number(args[i++]);\n case '%j':\n try {\n return JSON.stringify(args[i++]);\n } catch (_) {\n return '[Circular]';\n }\n default:\n return x;\n }\n });\n for (var x = args[i]; i < len; x = args[++i]) {\n if (isNull(x) || !isObject(x)) {\n str += ' ' + x;\n } else {\n str += ' ' + inspect(x);\n }\n }\n return str;\n};\n\n\n// Mark that a method should not be used.\n// Returns a modified function which warns once by default.\n// If --no-deprecation is set, then it is a no-op.\nexport function deprecate(fn, msg) {\n // Allow for deprecating things in the process of starting up.\n if (isUndefined(global.process)) {\n return function() {\n return deprecate(fn, msg).apply(this, arguments);\n };\n }\n\n if (process.noDeprecation === true) {\n return fn;\n }\n\n var warned = false;\n function deprecated() {\n if (!warned) {\n if (process.throwDeprecation) {\n throw new Error(msg);\n } else if (process.traceDeprecation) {\n console.trace(msg);\n } else {\n console.error(msg);\n }\n warned = true;\n }\n return fn.apply(this, arguments);\n }\n\n return deprecated;\n};\n\n\nvar debugs = {};\nvar debugEnviron;\nexport function debuglog(set) {\n if (isUndefined(debugEnviron))\n debugEnviron = process.env.NODE_DEBUG || '';\n set = set.toUpperCase();\n if (!debugs[set]) {\n if (new RegExp('\\\\b' + set + '\\\\b', 'i').test(debugEnviron)) {\n var pid = 0;\n debugs[set] = function() {\n var msg = format.apply(null, arguments);\n console.error('%s %d: %s', set, pid, msg);\n };\n } else {\n debugs[set] = function() {};\n }\n }\n return debugs[set];\n};\n\n\n/**\n * Echos the value of a value. Trys to print the value out\n * in the best way possible given the different types.\n *\n * @param {Object} obj The object to print out.\n * @param {Object} opts Optional options object that alters the output.\n */\n/* legacy: obj, showHidden, depth, colors*/\nexport function inspect(obj, opts) {\n // default options\n var ctx = {\n seen: [],\n stylize: stylizeNoColor\n };\n // legacy...\n if (arguments.length >= 3) ctx.depth = arguments[2];\n if (arguments.length >= 4) ctx.colors = arguments[3];\n if (isBoolean(opts)) {\n // legacy...\n ctx.showHidden = opts;\n } else if (opts) {\n // got an \"options\" object\n _extend(ctx, opts);\n }\n // set default options\n if (isUndefined(ctx.showHidden)) ctx.showHidden = false;\n if (isUndefined(ctx.depth)) ctx.depth = 2;\n if (isUndefined(ctx.colors)) ctx.colors = false;\n if (isUndefined(ctx.customInspect)) ctx.customInspect = true;\n if (ctx.colors) ctx.stylize = stylizeWithColor;\n return formatValue(ctx, obj, ctx.depth);\n}\n\n// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics\ninspect.colors = {\n 'bold' : [1, 22],\n 'italic' : [3, 23],\n 'underline' : [4, 24],\n 'inverse' : [7, 27],\n 'white' : [37, 39],\n 'grey' : [90, 39],\n 'black' : [30, 39],\n 'blue' : [34, 39],\n 'cyan' : [36, 39],\n 'green' : [32, 39],\n 'magenta' : [35, 39],\n 'red' : [31, 39],\n 'yellow' : [33, 39]\n};\n\n// Don't use 'blue' not visible on cmd.exe\ninspect.styles = {\n 'special': 'cyan',\n 'number': 'yellow',\n 'boolean': 'yellow',\n 'undefined': 'grey',\n 'null': 'bold',\n 'string': 'green',\n 'date': 'magenta',\n // \"name\": intentionally not styling\n 'regexp': 'red'\n};\n\n\nfunction stylizeWithColor(str, styleType) {\n var style = inspect.styles[styleType];\n\n if (style) {\n return '\\u001b[' + inspect.colors[style][0] + 'm' + str +\n '\\u001b[' + inspect.colors[style][1] + 'm';\n } else {\n return str;\n }\n}\n\n\nfunction stylizeNoColor(str, styleType) {\n return str;\n}\n\n\nfunction arrayToHash(array) {\n var hash = {};\n\n array.forEach(function(val, idx) {\n hash[val] = true;\n });\n\n return hash;\n}\n\n\nfunction formatValue(ctx, value, recurseTimes) {\n // Provide a hook for user-specified inspect functions.\n // Check that value is an object with an inspect function on it\n if (ctx.customInspect &&\n value &&\n isFunction(value.inspect) &&\n // Filter out the util module, it's inspect function is special\n value.inspect !== inspect &&\n // Also filter out any prototype objects using the circular check.\n !(value.constructor && value.constructor.prototype === value)) {\n var ret = value.inspect(recurseTimes, ctx);\n if (!isString(ret)) {\n ret = formatValue(ctx, ret, recurseTimes);\n }\n return ret;\n }\n\n // Primitive types cannot have properties\n var primitive = formatPrimitive(ctx, value);\n if (primitive) {\n return primitive;\n }\n\n // Look up the keys of the object.\n var keys = Object.keys(value);\n var visibleKeys = arrayToHash(keys);\n\n if (ctx.showHidden) {\n keys = Object.getOwnPropertyNames(value);\n }\n\n // IE doesn't make error fields non-enumerable\n // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx\n if (isError(value)\n && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {\n return formatError(value);\n }\n\n // Some type of object without properties can be shortcutted.\n if (keys.length === 0) {\n if (isFunction(value)) {\n var name = value.name ? ': ' + value.name : '';\n return ctx.stylize('[Function' + name + ']', 'special');\n }\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n }\n if (isDate(value)) {\n return ctx.stylize(Date.prototype.toString.call(value), 'date');\n }\n if (isError(value)) {\n return formatError(value);\n }\n }\n\n var base = '', array = false, braces = ['{', '}'];\n\n // Make Array say that they are Array\n if (isArray(value)) {\n array = true;\n braces = ['[', ']'];\n }\n\n // Make functions say that they are functions\n if (isFunction(value)) {\n var n = value.name ? ': ' + value.name : '';\n base = ' [Function' + n + ']';\n }\n\n // Make RegExps say that they are RegExps\n if (isRegExp(value)) {\n base = ' ' + RegExp.prototype.toString.call(value);\n }\n\n // Make dates with properties first say the date\n if (isDate(value)) {\n base = ' ' + Date.prototype.toUTCString.call(value);\n }\n\n // Make error with message first say the error\n if (isError(value)) {\n base = ' ' + formatError(value);\n }\n\n if (keys.length === 0 && (!array || value.length == 0)) {\n return braces[0] + base + braces[1];\n }\n\n if (recurseTimes < 0) {\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n } else {\n return ctx.stylize('[Object]', 'special');\n }\n }\n\n ctx.seen.push(value);\n\n var output;\n if (array) {\n output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);\n } else {\n output = keys.map(function(key) {\n return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);\n });\n }\n\n ctx.seen.pop();\n\n return reduceToSingleString(output, base, braces);\n}\n\n\nfunction formatPrimitive(ctx, value) {\n if (isUndefined(value))\n return ctx.stylize('undefined', 'undefined');\n if (isString(value)) {\n var simple = '\\'' + JSON.stringify(value).replace(/^\"|\"$/g, '')\n .replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"') + '\\'';\n return ctx.stylize(simple, 'string');\n }\n if (isNumber(value))\n return ctx.stylize('' + value, 'number');\n if (isBoolean(value))\n return ctx.stylize('' + value, 'boolean');\n // For some reason typeof null is \"object\", so special case here.\n if (isNull(value))\n return ctx.stylize('null', 'null');\n}\n\n\nfunction formatError(value) {\n return '[' + Error.prototype.toString.call(value) + ']';\n}\n\n\nfunction formatArray(ctx, value, recurseTimes, visibleKeys, keys) {\n var output = [];\n for (var i = 0, l = value.length; i < l; ++i) {\n if (hasOwnProperty(value, String(i))) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n String(i), true));\n } else {\n output.push('');\n }\n }\n keys.forEach(function(key) {\n if (!key.match(/^\\d+$/)) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n key, true));\n }\n });\n return output;\n}\n\n\nfunction formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {\n var name, str, desc;\n desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };\n if (desc.get) {\n if (desc.set) {\n str = ctx.stylize('[Getter/Setter]', 'special');\n } else {\n str = ctx.stylize('[Getter]', 'special');\n }\n } else {\n if (desc.set) {\n str = ctx.stylize('[Setter]', 'special');\n }\n }\n if (!hasOwnProperty(visibleKeys, key)) {\n name = '[' + key + ']';\n }\n if (!str) {\n if (ctx.seen.indexOf(desc.value) < 0) {\n if (isNull(recurseTimes)) {\n str = formatValue(ctx, desc.value, null);\n } else {\n str = formatValue(ctx, desc.value, recurseTimes - 1);\n }\n if (str.indexOf('\\n') > -1) {\n if (array) {\n str = str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n').substr(2);\n } else {\n str = '\\n' + str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n');\n }\n }\n } else {\n str = ctx.stylize('[Circular]', 'special');\n }\n }\n if (isUndefined(name)) {\n if (array && key.match(/^\\d+$/)) {\n return str;\n }\n name = JSON.stringify('' + key);\n if (name.match(/^\"([a-zA-Z_][a-zA-Z_0-9]*)\"$/)) {\n name = name.substr(1, name.length - 2);\n name = ctx.stylize(name, 'name');\n } else {\n name = name.replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"')\n .replace(/(^\"|\"$)/g, \"'\");\n name = ctx.stylize(name, 'string');\n }\n }\n\n return name + ': ' + str;\n}\n\n\nfunction reduceToSingleString(output, base, braces) {\n var numLinesEst = 0;\n var length = output.reduce(function(prev, cur) {\n numLinesEst++;\n if (cur.indexOf('\\n') >= 0) numLinesEst++;\n return prev + cur.replace(/\\u001b\\[\\d\\d?m/g, '').length + 1;\n }, 0);\n\n if (length > 60) {\n return braces[0] +\n (base === '' ? '' : base + '\\n ') +\n ' ' +\n output.join(',\\n ') +\n ' ' +\n braces[1];\n }\n\n return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];\n}\n\n\n// NOTE: These type checking functions intentionally don't use `instanceof`\n// because it is fragile and can be easily faked with `Object.create()`.\nexport function isArray(ar) {\n return Array.isArray(ar);\n}\n\nexport function isBoolean(arg) {\n return typeof arg === 'boolean';\n}\n\nexport function isNull(arg) {\n return arg === null;\n}\n\nexport function isNullOrUndefined(arg) {\n return arg == null;\n}\n\nexport function isNumber(arg) {\n return typeof arg === 'number';\n}\n\nexport function isString(arg) {\n return typeof arg === 'string';\n}\n\nexport function isSymbol(arg) {\n return typeof arg === 'symbol';\n}\n\nexport function isUndefined(arg) {\n return arg === void 0;\n}\n\nexport function isRegExp(re) {\n return isObject(re) && objectToString(re) === '[object RegExp]';\n}\n\nexport function isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\n\nexport function isDate(d) {\n return isObject(d) && objectToString(d) === '[object Date]';\n}\n\nexport function isError(e) {\n return isObject(e) &&\n (objectToString(e) === '[object Error]' || e instanceof Error);\n}\n\nexport function isFunction(arg) {\n return typeof arg === 'function';\n}\n\nexport function isPrimitive(arg) {\n return arg === null ||\n typeof arg === 'boolean' ||\n typeof arg === 'number' ||\n typeof arg === 'string' ||\n typeof arg === 'symbol' || // ES6 symbol\n typeof arg === 'undefined';\n}\n\nexport function isBuffer(maybeBuf) {\n return Buffer.isBuffer(maybeBuf);\n}\n\nfunction objectToString(o) {\n return Object.prototype.toString.call(o);\n}\n\n\nfunction pad(n) {\n return n < 10 ? '0' + n.toString(10) : n.toString(10);\n}\n\n\nvar months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',\n 'Oct', 'Nov', 'Dec'];\n\n// 26 Feb 16:19:34\nfunction timestamp() {\n var d = new Date();\n var time = [pad(d.getHours()),\n pad(d.getMinutes()),\n pad(d.getSeconds())].join(':');\n return [d.getDate(), months[d.getMonth()], time].join(' ');\n}\n\n\n// log is just a thin wrapper to console.log that prepends a timestamp\nexport function log() {\n console.log('%s - %s', timestamp(), format.apply(null, arguments));\n}\n\n\n/**\n * Inherit the prototype methods from one constructor into another.\n *\n * The Function.prototype.inherits from lang.js rewritten as a standalone\n * function (not on Function.prototype). NOTE: If this file is to be loaded\n * during bootstrapping this function needs to be rewritten using some native\n * functions as prototype setup using normal JavaScript does not work as\n * expected during bootstrapping (see mirror.js in r114903).\n *\n * @param {function} ctor Constructor function which needs to inherit the\n * prototype.\n * @param {function} superCtor Constructor function to inherit prototype from.\n */\nimport inherits from './inherits';\nexport {inherits}\n\nexport function _extend(origin, add) {\n // Don't do anything if add isn't an object\n if (!add || !isObject(add)) return origin;\n\n var keys = Object.keys(add);\n var i = keys.length;\n while (i--) {\n origin[keys[i]] = add[keys[i]];\n }\n return origin;\n};\n\nfunction hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\nexport default {\n inherits: inherits,\n _extend: _extend,\n log: log,\n isBuffer: isBuffer,\n isPrimitive: isPrimitive,\n isFunction: isFunction,\n isError: isError,\n isDate: isDate,\n isObject: isObject,\n isRegExp: isRegExp,\n isUndefined: isUndefined,\n isSymbol: isSymbol,\n isString: isString,\n isNumber: isNumber,\n isNullOrUndefined: isNullOrUndefined,\n isNull: isNull,\n isBoolean: isBoolean,\n isArray: isArray,\n inspect: inspect,\n deprecate: deprecate,\n format: format,\n debuglog: debuglog\n}\n","import { isString } from \"util\";\nimport DiacriticMapperInterface from '../interfaces/diacritic-mapper.interface';\n\nabstract class DiacriticAbstractHandler implements ProxyHandler {\n get(target: DiacriticMapperInterface, prop: PropertyKey, receiver: any): any {\n if (isString(prop) && prop.length === 1) {\n return this.diacriticTrap(target, prop);\n }\n return Reflect.get(target, prop, receiver);\n }\n\n has(target: DiacriticMapperInterface, prop: PropertyKey): boolean {\n return (isString(prop) && prop.length === 1) || Reflect.has(target, prop);\n }\n\n protected diacriticTrap(target: DiacriticMapperInterface, char: string): any {\n return;\n }\n}\n\nexport default DiacriticAbstractHandler;","import DiacriticMapperInterface from '../interfaces/diacritic-mapper.interface';\nimport DiacriticAbstractHandler from './diacritic-abstract-handler.class';\nimport { isString } from 'util';\n\nclass DiacriticRemoverHandler extends DiacriticAbstractHandler {\n protected diacriticTrap(target: DiacriticMapperInterface, char: string): string {\n super.diacriticTrap(target, char);\n const upperCase: boolean = target.isUpperCase(char);\n const lowerCaseChar = char.toLowerCase();\n\n const plainChar = Object.keys(target.dictionary)\n .find(c => isString(target.dictionary[c]) && target.dictionary[c].includes(lowerCaseChar));\n if (upperCase && plainChar) {\n return plainChar.toUpperCase();\n }\n return plainChar || char;\n }\n}\n\nexport default DiacriticRemoverHandler;","import DiacriticAbstractHandler from './diacritic-abstract-handler.class';\nimport DiacriticMapperInterface from '../interfaces/diacritic-mapper.interface';\n\nclass DiacriticMatcherHandler extends DiacriticAbstractHandler {\n protected diacriticTrap(target: DiacriticMapperInterface, char: string): string {\n super.diacriticTrap(target, char);\n const diacritics = target.dictionary[char.toLowerCase()];\n if (diacritics) {\n return target.isUpperCase(char) ? diacritics.toUpperCase() : diacritics;\n }\n return char;\n }\n}\n\nexport default DiacriticMatcherHandler;","import DiacriticAbstractHandler from './diacritic-abstract-handler.class';\nimport DiacriticMapperInterface from '../interfaces/diacritic-mapper.interface';\n\nclass DiacriticInsensitiveMatcherHandler extends DiacriticAbstractHandler {\n protected diacriticTrap(target: DiacriticMapperInterface, char: string): string {\n super.diacriticTrap(target, char);\n const diacritics = target.dictionary[char.toLowerCase()];\n return diacritics ? (\n diacritics + diacritics.toUpperCase()\n ) : char;\n }\n}\n\nexport default DiacriticInsensitiveMatcherHandler;","import DiacriticAbstractHandler from './diacritic-abstract-handler.class';\nimport DiacriticMapperInterface from '../interfaces/diacritic-mapper.interface';\n\nclass DiacriticValidatorHandler extends DiacriticAbstractHandler {\n protected diacriticTrap(target: DiacriticMapperInterface, char: string): RegExp {\n super.diacriticTrap(target, char);\n const diacritics = target.dictionary[char.toLowerCase()];\n let matchingDiacritics = '';\n if (diacritics) {\n matchingDiacritics = target.isUpperCase(char) ? diacritics.toUpperCase() : diacritics;\n }\n return new RegExp(`[${char}${matchingDiacritics}]`, 'u');\n }\n}\n\nexport default DiacriticValidatorHandler;","import DiacriticAbstractHandler from './diacritic-abstract-handler.class';\nimport DiacriticMapperInterface from '../interfaces/diacritic-mapper.interface';\n\nclass DiacriticInsensitiveValidatorHandler extends DiacriticAbstractHandler {\n protected diacriticTrap(target: DiacriticMapperInterface, char: string): RegExp {\n super.diacriticTrap(target, char);\n return new RegExp(`[${char}${target.insensitiveMatcher[char] || ''}]`, 'ui');\n }\n}\n\nexport default DiacriticInsensitiveValidatorHandler;","import DiacriticSetInterface from '../interfaces/diacritic-set.interface';\nimport DiacriticValidatorSetInterface from '../interfaces/diacritic-validator-set.interface';\nimport DiacriticMapperInterface from '../interfaces/diacritic-mapper.interface';\nimport DiacriticMatcherHandler from './diacritic-matcher-handler.class';\nimport DiacriticInsensitiveMatcherHandler from './diacritic-insensitive-matcher-handler.class';\nimport DiacriticValidatorHandler from './diacritic-validator-handler.class';\nimport DiacriticInsensitiveValidatorHandler from './diacritic-insensitive-validator-handler.class';\nimport { isString } from 'util';\n\nclass DiacriticMapperCore implements DiacriticMapperInterface {\n\n [key:string]: string|any;\n\n public dictionary: DiacriticSetInterface;\n public matcher: DiacriticSetInterface;\n\n public insensitiveMatcher: DiacriticSetInterface;\n\n public validator: DiacriticValidatorSetInterface;\n\n public insensitiveValidator: DiacriticValidatorSetInterface;\n\n public constructor(dictionaries: DiacriticSetInterface[]) {\n const dictionary = dictionaries.reduce((accumulator: DiacriticSetInterface, currentDict: DiacriticSetInterface) => {\n Object.entries(currentDict).forEach(([letter, diacritics]) => {\n if (isString(diacritics)){\n if (letter in accumulator) {\n const newDiacritics = diacritics.split('').filter(l => !accumulator[letter].includes(l)).join('');\n accumulator[letter] += newDiacritics;\n } else {\n accumulator[letter] = diacritics;\n }\n }\n });\n return accumulator;\n }, {});\n\n this.dictionary = Object.freeze(dictionary);\n this.matcher = new Proxy(this, new DiacriticMatcherHandler());\n this.insensitiveMatcher = new Proxy(this, new DiacriticInsensitiveMatcherHandler());\n this.validator = new Proxy(this, new DiacriticValidatorHandler());\n this.insensitiveValidator = new Proxy(this, new DiacriticInsensitiveValidatorHandler());\n }\n\n public matcherBy(regexp: RegExp): string {\n const lowerCase = Object.entries(this.dictionary)\n .filter(([key, value]) => value && regexp.test(key))\n .map(([,value]) => value);\n\n const upperCase = Object.entries(this.dictionary)\n .filter(([key, value]) => value && regexp.test(key.toUpperCase()))\n .map(([,value]) => value.toUpperCase());\n\n return [...lowerCase, ...upperCase].join('');\n }\n\n public replace(text: string): string {\n return text.replace(/./g, (char: string) => this[char]);\n }\n\n /**\n * Check if the given string is uppercase\n *\n * @param {string} [text=''] string to check\n * @returns {boolean} true if text is uppercase\n * @memberof DiacriticMapperCore\n */\n public isUpperCase(text: string = ''): boolean {\n return text.toUpperCase() === text;\n }\n\n /**\n * Check if the given string is lowercase\n *\n * @param {string} [text=''] string to check\n * @returns {boolean} true if text is lowercase\n * @memberof DiacriticMapperCore\n */\n public isLowerCase(text: string = ''): boolean {\n return text.toLowerCase() === text;\n }\n}\n\nexport default DiacriticMapperCore;","/**\n * i18n jsons and i18n-all.ts use material from Wikipedia\n * Article: https://en.wikipedia.org/wiki/Diacritic\n * License: CC-BY-SA 3.0\n */\nexport default {\n \"a\": \"áäâàåÄąāãă\",\n \"e\": \"éèêëěÊęėēё\",\n \"i\": \"íîïi̇řìįī\",\n \"o\": \"óôöòøōõơ\",\n \"u\": \"úûüùůŭųūư\",\n \"y\": \"ýÿŷỳ\",\n \"n\": \"ñňŋņń\",\n \"l\": \"ḷŀłļĺľ\",\n \"h\": \"ḥĥȟħ\",\n \"c\": \"çčćĉĊ\",\n \"g\": \"ğĝǧģĠġ\",\n \"s\": \"şšŝṣșſś\",\n \"у\": \"ў\",\n \"и\": \"йѝ\",\n \"е\": \"ё\",\n \"d\": \"đďðḏ\",\n \"z\": \"žŻźż\",\n \"t\": \"ťțțṭ\",\n \"w\": \"ẅŵẃẁ\",\n \"ae\": \"æ\",\n \"ss\": \"ß\",\n \"α\": \"ά\",\n \"ε\": \"έ\",\n \"η\": \"ή\",\n \"ι\": \"ίΐϊ\",\n \"ο\": \"ό\",\n \"υ\": \"ύΰϋ\",\n \"ω\": \"ώ\",\n \"j\": \"ĵ\",\n \"oe\": \"œ\",\n \"\": \"ʰ'ʼ·׳\",\n \"ii\": \"î\",\n \"k\": \"ķ\",\n \"к\": \"ќ\",\n \"г\": \"ѓґ\",\n \"ij\": \"ij\",\n \"r\": \"ŕ\",\n \"і\": \"ї\"\n};","import DiacriticRemoverHandler from './diacritic-remover-handler.class';\nimport DiacriticSetInterface from '../interfaces/diacritic-set.interface';\nimport DiacriticMapperCore from './diacritic-mapper-core.class';\n\nimport I18N_ALL from '../i18n/i18n-all.const';\n\nclass DiacriticRemover extends DiacriticMapperCore{\n [letter: string]: string|any;\n constructor(...dictionaries: DiacriticSetInterface[]) {\n super(dictionaries.length ? dictionaries : [I18N_ALL as DiacriticSetInterface]);\n Object.defineProperty(this, 'dictionary', {\n enumerable: false,\n configurable: false\n });\n return new Proxy(this, new DiacriticRemoverHandler());\n }\n}\nexport default DiacriticRemover;"],"names":["extendStatics","d","b","Object","setPrototypeOf","__proto__","Array","p","hasOwnProperty","__extends","__","this","constructor","prototype","create","isString","arg","DiacriticAbstractHandler","target","prop","receiver","length","diacriticTrap","Reflect","get","has","char","DiacriticRemoverHandler","_super","upperCase","isUpperCase","lowerCaseChar","toLowerCase","plainChar","keys","dictionary","find","c","includes","toUpperCase","DiacriticMatcherHandler","diacritics","DiacriticInsensitiveMatcherHandler","DiacriticValidatorHandler","matchingDiacritics","RegExp","DiacriticInsensitiveValidatorHandler","insensitiveMatcher","dictionaries","reduce","accumulator","currentDict","entries","forEach","_a","letter","newDiacritics","split","filter","l","join","freeze","matcher","Proxy","validator","insensitiveValidator","DiacriticMapperCore","regexp","s","i","il","arguments","r","k","a","j","jl","__spreadArrays","key","test","map","text","replace","_this","e","o","u","y","n","h","g","у","и","е","z","t","w","ae","ss","α","ε","η","ι","ο","υ","ω","oe","ii","к","г","ij","і","_i","I18N_ALL","defineProperty","enumerable","configurable"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAgBA,IAAIA,EAAgB,SAASC,EAAGC,GAI5B,OAHAF,EAAgBG,OAAOC,gBAClB,CAAEC,UAAW,cAAgBC,OAAS,SAAUL,EAAGC,GAAKD,EAAEI,UAAYH,IACvE,SAAUD,EAAGC,GAAK,IAAK,IAAIK,KAAKL,EAAOA,EAAEM,eAAeD,KAAIN,EAAEM,GAAKL,EAAEK,MACpDN,EAAGC,IAGrB,SAASO,EAAUR,EAAGC,GAEzB,SAASQ,IAAOC,KAAKC,YAAcX,EADnCD,EAAcC,EAAGC,GAEjBD,EAAEY,UAAkB,OAANX,EAAaC,OAAOW,OAAOZ,IAAMQ,EAAGG,UAAYX,EAAEW,UAAW,IAAIH,GCyb5E,SAASK,EAASC,GACvB,MAAsB,iBAARA,ECjdhB,iBAAA,cAeA,OAdIC,gBAAA,SAAIC,EAAkCC,EAAmBC,GACrD,OAAIL,EAASI,IAAyB,IAAhBA,EAAKE,OAChBV,KAAKW,cAAcJ,EAAQC,GAE/BI,QAAQC,IAAIN,EAAQC,EAAMC,IAGrCH,gBAAA,SAAIC,EAAkCC,GAClC,OAAQJ,EAASI,IAAyB,IAAhBA,EAAKE,QAAiBE,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B,GAAa,YAAMf,kBAEOqB,KAAK,KAGtCM,oBAAP,SAAee,GAAf,WACI,OAAOA,EAAKC,QAAQ,MAAM,SAACxD,GAAiB,OAAAyD,EAAKzD,OAU9CwC,wBAAP,SAAmBe,GACf,oBADeA,MACRA,EAAK1C,gBAAkB0C,GAU3Bf,wBAAP,SAAmBe,GACf,oBADeA,MACRA,EAAKjD,gBAAkBiD,UC1EvB,CACXP,EAAK,aACLU,EAAK,aACLf,EAAK,YACLgB,EAAK,WACLC,EAAK,YACLC,EAAK,OACLC,EAAK,QACL7B,EAAK,SACL8B,EAAK,OACLpD,EAAK,QACLqD,EAAK,SACLtB,EAAK,UACLuB,IAAK,IACLC,IAAK,KACLC,IAAK,IACL5F,EAAK,OACL6F,EAAK,OACLC,EAAK,OACLC,EAAK,OACLC,GAAM,IACNC,GAAM,IACNC,IAAK,IACLC,IAAK,IACLC,IAAK,IACLC,IAAK,MACLC,IAAK,IACLC,IAAK,MACLC,IAAK,IACL9B,EAAK,IACL+B,GAAM,IACN,GAAI,QACJC,GAAM,IACNlC,EAAK,IACLmC,IAAK,IACLC,IAAK,KACLC,GAAM,IACNtC,EAAK,IACLuC,IAAK,mBCnCL,iBAAY,aAAAC,mBAAAA,IAAAhE,kBAAZ,MACIpB,YAAMoB,EAAa3B,OAAS2B,EAAe,CAACiE,UAK5C,OAJA9G,OAAO+G,eAAe/B,EAAM,aAAc,CACtCgC,YAAY,EACZC,cAAc,IAEX,IAAIrD,MAAMoB,EAAM,IAAIxD,GAEnC,OAV+BlB,UAAAyD"} \ No newline at end of file +{"version":3,"file":"diacritic-remover.es.js","sources":["../node_modules/rollup-plugin-node-builtins/src/es6/util.js","../src/classes/diacritic-abstract-handler.class.ts","../src/classes/diacritic-remover-handler.class.ts","../src/classes/diacritic-matcher-handler.class.ts","../src/classes/diacritic-insensitive-matcher-handler.class.ts","../src/classes/diacritic-validator-handler.class.ts","../src/classes/diacritic-insensitive-validator-handler.class.ts","../src/classes/diacritic-mapper-core.class.ts","../src/i18n/i18n-all.const.ts","../src/classes/diacritic-remover.class.ts"],"sourcesContent":["// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\nimport process from 'process';\nvar formatRegExp = /%[sdj%]/g;\nexport function format(f) {\n if (!isString(f)) {\n var objects = [];\n for (var i = 0; i < arguments.length; i++) {\n objects.push(inspect(arguments[i]));\n }\n return objects.join(' ');\n }\n\n var i = 1;\n var args = arguments;\n var len = args.length;\n var str = String(f).replace(formatRegExp, function(x) {\n if (x === '%%') return '%';\n if (i >= len) return x;\n switch (x) {\n case '%s': return String(args[i++]);\n case '%d': return Number(args[i++]);\n case '%j':\n try {\n return JSON.stringify(args[i++]);\n } catch (_) {\n return '[Circular]';\n }\n default:\n return x;\n }\n });\n for (var x = args[i]; i < len; x = args[++i]) {\n if (isNull(x) || !isObject(x)) {\n str += ' ' + x;\n } else {\n str += ' ' + inspect(x);\n }\n }\n return str;\n};\n\n\n// Mark that a method should not be used.\n// Returns a modified function which warns once by default.\n// If --no-deprecation is set, then it is a no-op.\nexport function deprecate(fn, msg) {\n // Allow for deprecating things in the process of starting up.\n if (isUndefined(global.process)) {\n return function() {\n return deprecate(fn, msg).apply(this, arguments);\n };\n }\n\n if (process.noDeprecation === true) {\n return fn;\n }\n\n var warned = false;\n function deprecated() {\n if (!warned) {\n if (process.throwDeprecation) {\n throw new Error(msg);\n } else if (process.traceDeprecation) {\n console.trace(msg);\n } else {\n console.error(msg);\n }\n warned = true;\n }\n return fn.apply(this, arguments);\n }\n\n return deprecated;\n};\n\n\nvar debugs = {};\nvar debugEnviron;\nexport function debuglog(set) {\n if (isUndefined(debugEnviron))\n debugEnviron = process.env.NODE_DEBUG || '';\n set = set.toUpperCase();\n if (!debugs[set]) {\n if (new RegExp('\\\\b' + set + '\\\\b', 'i').test(debugEnviron)) {\n var pid = 0;\n debugs[set] = function() {\n var msg = format.apply(null, arguments);\n console.error('%s %d: %s', set, pid, msg);\n };\n } else {\n debugs[set] = function() {};\n }\n }\n return debugs[set];\n};\n\n\n/**\n * Echos the value of a value. Trys to print the value out\n * in the best way possible given the different types.\n *\n * @param {Object} obj The object to print out.\n * @param {Object} opts Optional options object that alters the output.\n */\n/* legacy: obj, showHidden, depth, colors*/\nexport function inspect(obj, opts) {\n // default options\n var ctx = {\n seen: [],\n stylize: stylizeNoColor\n };\n // legacy...\n if (arguments.length >= 3) ctx.depth = arguments[2];\n if (arguments.length >= 4) ctx.colors = arguments[3];\n if (isBoolean(opts)) {\n // legacy...\n ctx.showHidden = opts;\n } else if (opts) {\n // got an \"options\" object\n _extend(ctx, opts);\n }\n // set default options\n if (isUndefined(ctx.showHidden)) ctx.showHidden = false;\n if (isUndefined(ctx.depth)) ctx.depth = 2;\n if (isUndefined(ctx.colors)) ctx.colors = false;\n if (isUndefined(ctx.customInspect)) ctx.customInspect = true;\n if (ctx.colors) ctx.stylize = stylizeWithColor;\n return formatValue(ctx, obj, ctx.depth);\n}\n\n// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics\ninspect.colors = {\n 'bold' : [1, 22],\n 'italic' : [3, 23],\n 'underline' : [4, 24],\n 'inverse' : [7, 27],\n 'white' : [37, 39],\n 'grey' : [90, 39],\n 'black' : [30, 39],\n 'blue' : [34, 39],\n 'cyan' : [36, 39],\n 'green' : [32, 39],\n 'magenta' : [35, 39],\n 'red' : [31, 39],\n 'yellow' : [33, 39]\n};\n\n// Don't use 'blue' not visible on cmd.exe\ninspect.styles = {\n 'special': 'cyan',\n 'number': 'yellow',\n 'boolean': 'yellow',\n 'undefined': 'grey',\n 'null': 'bold',\n 'string': 'green',\n 'date': 'magenta',\n // \"name\": intentionally not styling\n 'regexp': 'red'\n};\n\n\nfunction stylizeWithColor(str, styleType) {\n var style = inspect.styles[styleType];\n\n if (style) {\n return '\\u001b[' + inspect.colors[style][0] + 'm' + str +\n '\\u001b[' + inspect.colors[style][1] + 'm';\n } else {\n return str;\n }\n}\n\n\nfunction stylizeNoColor(str, styleType) {\n return str;\n}\n\n\nfunction arrayToHash(array) {\n var hash = {};\n\n array.forEach(function(val, idx) {\n hash[val] = true;\n });\n\n return hash;\n}\n\n\nfunction formatValue(ctx, value, recurseTimes) {\n // Provide a hook for user-specified inspect functions.\n // Check that value is an object with an inspect function on it\n if (ctx.customInspect &&\n value &&\n isFunction(value.inspect) &&\n // Filter out the util module, it's inspect function is special\n value.inspect !== inspect &&\n // Also filter out any prototype objects using the circular check.\n !(value.constructor && value.constructor.prototype === value)) {\n var ret = value.inspect(recurseTimes, ctx);\n if (!isString(ret)) {\n ret = formatValue(ctx, ret, recurseTimes);\n }\n return ret;\n }\n\n // Primitive types cannot have properties\n var primitive = formatPrimitive(ctx, value);\n if (primitive) {\n return primitive;\n }\n\n // Look up the keys of the object.\n var keys = Object.keys(value);\n var visibleKeys = arrayToHash(keys);\n\n if (ctx.showHidden) {\n keys = Object.getOwnPropertyNames(value);\n }\n\n // IE doesn't make error fields non-enumerable\n // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx\n if (isError(value)\n && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {\n return formatError(value);\n }\n\n // Some type of object without properties can be shortcutted.\n if (keys.length === 0) {\n if (isFunction(value)) {\n var name = value.name ? ': ' + value.name : '';\n return ctx.stylize('[Function' + name + ']', 'special');\n }\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n }\n if (isDate(value)) {\n return ctx.stylize(Date.prototype.toString.call(value), 'date');\n }\n if (isError(value)) {\n return formatError(value);\n }\n }\n\n var base = '', array = false, braces = ['{', '}'];\n\n // Make Array say that they are Array\n if (isArray(value)) {\n array = true;\n braces = ['[', ']'];\n }\n\n // Make functions say that they are functions\n if (isFunction(value)) {\n var n = value.name ? ': ' + value.name : '';\n base = ' [Function' + n + ']';\n }\n\n // Make RegExps say that they are RegExps\n if (isRegExp(value)) {\n base = ' ' + RegExp.prototype.toString.call(value);\n }\n\n // Make dates with properties first say the date\n if (isDate(value)) {\n base = ' ' + Date.prototype.toUTCString.call(value);\n }\n\n // Make error with message first say the error\n if (isError(value)) {\n base = ' ' + formatError(value);\n }\n\n if (keys.length === 0 && (!array || value.length == 0)) {\n return braces[0] + base + braces[1];\n }\n\n if (recurseTimes < 0) {\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n } else {\n return ctx.stylize('[Object]', 'special');\n }\n }\n\n ctx.seen.push(value);\n\n var output;\n if (array) {\n output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);\n } else {\n output = keys.map(function(key) {\n return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);\n });\n }\n\n ctx.seen.pop();\n\n return reduceToSingleString(output, base, braces);\n}\n\n\nfunction formatPrimitive(ctx, value) {\n if (isUndefined(value))\n return ctx.stylize('undefined', 'undefined');\n if (isString(value)) {\n var simple = '\\'' + JSON.stringify(value).replace(/^\"|\"$/g, '')\n .replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"') + '\\'';\n return ctx.stylize(simple, 'string');\n }\n if (isNumber(value))\n return ctx.stylize('' + value, 'number');\n if (isBoolean(value))\n return ctx.stylize('' + value, 'boolean');\n // For some reason typeof null is \"object\", so special case here.\n if (isNull(value))\n return ctx.stylize('null', 'null');\n}\n\n\nfunction formatError(value) {\n return '[' + Error.prototype.toString.call(value) + ']';\n}\n\n\nfunction formatArray(ctx, value, recurseTimes, visibleKeys, keys) {\n var output = [];\n for (var i = 0, l = value.length; i < l; ++i) {\n if (hasOwnProperty(value, String(i))) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n String(i), true));\n } else {\n output.push('');\n }\n }\n keys.forEach(function(key) {\n if (!key.match(/^\\d+$/)) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n key, true));\n }\n });\n return output;\n}\n\n\nfunction formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {\n var name, str, desc;\n desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };\n if (desc.get) {\n if (desc.set) {\n str = ctx.stylize('[Getter/Setter]', 'special');\n } else {\n str = ctx.stylize('[Getter]', 'special');\n }\n } else {\n if (desc.set) {\n str = ctx.stylize('[Setter]', 'special');\n }\n }\n if (!hasOwnProperty(visibleKeys, key)) {\n name = '[' + key + ']';\n }\n if (!str) {\n if (ctx.seen.indexOf(desc.value) < 0) {\n if (isNull(recurseTimes)) {\n str = formatValue(ctx, desc.value, null);\n } else {\n str = formatValue(ctx, desc.value, recurseTimes - 1);\n }\n if (str.indexOf('\\n') > -1) {\n if (array) {\n str = str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n').substr(2);\n } else {\n str = '\\n' + str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n');\n }\n }\n } else {\n str = ctx.stylize('[Circular]', 'special');\n }\n }\n if (isUndefined(name)) {\n if (array && key.match(/^\\d+$/)) {\n return str;\n }\n name = JSON.stringify('' + key);\n if (name.match(/^\"([a-zA-Z_][a-zA-Z_0-9]*)\"$/)) {\n name = name.substr(1, name.length - 2);\n name = ctx.stylize(name, 'name');\n } else {\n name = name.replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"')\n .replace(/(^\"|\"$)/g, \"'\");\n name = ctx.stylize(name, 'string');\n }\n }\n\n return name + ': ' + str;\n}\n\n\nfunction reduceToSingleString(output, base, braces) {\n var numLinesEst = 0;\n var length = output.reduce(function(prev, cur) {\n numLinesEst++;\n if (cur.indexOf('\\n') >= 0) numLinesEst++;\n return prev + cur.replace(/\\u001b\\[\\d\\d?m/g, '').length + 1;\n }, 0);\n\n if (length > 60) {\n return braces[0] +\n (base === '' ? '' : base + '\\n ') +\n ' ' +\n output.join(',\\n ') +\n ' ' +\n braces[1];\n }\n\n return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];\n}\n\n\n// NOTE: These type checking functions intentionally don't use `instanceof`\n// because it is fragile and can be easily faked with `Object.create()`.\nexport function isArray(ar) {\n return Array.isArray(ar);\n}\n\nexport function isBoolean(arg) {\n return typeof arg === 'boolean';\n}\n\nexport function isNull(arg) {\n return arg === null;\n}\n\nexport function isNullOrUndefined(arg) {\n return arg == null;\n}\n\nexport function isNumber(arg) {\n return typeof arg === 'number';\n}\n\nexport function isString(arg) {\n return typeof arg === 'string';\n}\n\nexport function isSymbol(arg) {\n return typeof arg === 'symbol';\n}\n\nexport function isUndefined(arg) {\n return arg === void 0;\n}\n\nexport function isRegExp(re) {\n return isObject(re) && objectToString(re) === '[object RegExp]';\n}\n\nexport function isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\n\nexport function isDate(d) {\n return isObject(d) && objectToString(d) === '[object Date]';\n}\n\nexport function isError(e) {\n return isObject(e) &&\n (objectToString(e) === '[object Error]' || e instanceof Error);\n}\n\nexport function isFunction(arg) {\n return typeof arg === 'function';\n}\n\nexport function isPrimitive(arg) {\n return arg === null ||\n typeof arg === 'boolean' ||\n typeof arg === 'number' ||\n typeof arg === 'string' ||\n typeof arg === 'symbol' || // ES6 symbol\n typeof arg === 'undefined';\n}\n\nexport function isBuffer(maybeBuf) {\n return Buffer.isBuffer(maybeBuf);\n}\n\nfunction objectToString(o) {\n return Object.prototype.toString.call(o);\n}\n\n\nfunction pad(n) {\n return n < 10 ? '0' + n.toString(10) : n.toString(10);\n}\n\n\nvar months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',\n 'Oct', 'Nov', 'Dec'];\n\n// 26 Feb 16:19:34\nfunction timestamp() {\n var d = new Date();\n var time = [pad(d.getHours()),\n pad(d.getMinutes()),\n pad(d.getSeconds())].join(':');\n return [d.getDate(), months[d.getMonth()], time].join(' ');\n}\n\n\n// log is just a thin wrapper to console.log that prepends a timestamp\nexport function log() {\n console.log('%s - %s', timestamp(), format.apply(null, arguments));\n}\n\n\n/**\n * Inherit the prototype methods from one constructor into another.\n *\n * The Function.prototype.inherits from lang.js rewritten as a standalone\n * function (not on Function.prototype). NOTE: If this file is to be loaded\n * during bootstrapping this function needs to be rewritten using some native\n * functions as prototype setup using normal JavaScript does not work as\n * expected during bootstrapping (see mirror.js in r114903).\n *\n * @param {function} ctor Constructor function which needs to inherit the\n * prototype.\n * @param {function} superCtor Constructor function to inherit prototype from.\n */\nimport inherits from './inherits';\nexport {inherits}\n\nexport function _extend(origin, add) {\n // Don't do anything if add isn't an object\n if (!add || !isObject(add)) return origin;\n\n var keys = Object.keys(add);\n var i = keys.length;\n while (i--) {\n origin[keys[i]] = add[keys[i]];\n }\n return origin;\n};\n\nfunction hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\nexport default {\n inherits: inherits,\n _extend: _extend,\n log: log,\n isBuffer: isBuffer,\n isPrimitive: isPrimitive,\n isFunction: isFunction,\n isError: isError,\n isDate: isDate,\n isObject: isObject,\n isRegExp: isRegExp,\n isUndefined: isUndefined,\n isSymbol: isSymbol,\n isString: isString,\n isNumber: isNumber,\n isNullOrUndefined: isNullOrUndefined,\n isNull: isNull,\n isBoolean: isBoolean,\n isArray: isArray,\n inspect: inspect,\n deprecate: deprecate,\n format: format,\n debuglog: debuglog\n}\n","import { isString } from \"util\";\nimport DiacriticMapperInterface from '../interfaces/diacritic-mapper.interface';\n\nabstract class DiacriticAbstractHandler implements ProxyHandler {\n get(target: DiacriticMapperInterface, prop: PropertyKey, receiver: any): any {\n if (isString(prop) && prop.length <= 1) {\n return this.diacriticTrap(target, prop);\n }\n return Reflect.get(target, prop, receiver);\n }\n\n protected diacriticTrap(target: DiacriticMapperInterface, char: string): any {\n return char;\n }\n}\n\nexport default DiacriticAbstractHandler;","import DiacriticMapperInterface from '../interfaces/diacritic-mapper.interface';\nimport DiacriticAbstractHandler from './diacritic-abstract-handler.class';\nimport { isString } from 'util';\n\nclass DiacriticRemoverHandler extends DiacriticAbstractHandler {\n protected diacriticTrap(target: DiacriticMapperInterface, char: string): string {\n super.diacriticTrap(target, char);\n const upperCase: boolean = target.isUpperCase(char);\n const lowerCaseChar = char.toLowerCase();\n\n const [plainChar] = Object.entries(target.dictionary)\n .find(([, diacritics]) => isString(diacritics) && diacritics.includes(lowerCaseChar)) || [];\n if (upperCase && plainChar) {\n return plainChar.toUpperCase();\n }\n return isString(plainChar) ? plainChar : char;\n }\n}\n\nexport default DiacriticRemoverHandler;","import DiacriticAbstractHandler from './diacritic-abstract-handler.class';\nimport DiacriticMapperInterface from '../interfaces/diacritic-mapper.interface';\n\nclass DiacriticMatcherHandler extends DiacriticAbstractHandler {\n protected diacriticTrap(target: DiacriticMapperInterface, char: string): string {\n let matcher = super.diacriticTrap(target, char);\n\n const diacritics = target.dictionary[char.toLowerCase()];\n if (diacritics) {\n matcher+= target.isUpperCase(matcher) ? diacritics.toUpperCase() : diacritics;\n }\n return matcher;\n }\n}\n\nexport default DiacriticMatcherHandler;","import DiacriticAbstractHandler from './diacritic-abstract-handler.class';\nimport DiacriticMapperInterface from '../interfaces/diacritic-mapper.interface';\n\nclass DiacriticInsensitiveMatcherHandler extends DiacriticAbstractHandler {\n protected diacriticTrap(target: DiacriticMapperInterface, char: string): string {\n const lowerCaseChar = super.diacriticTrap(target, char).toLowerCase();\n const insensitiveMatcher = new Set([lowerCaseChar, lowerCaseChar.toUpperCase()]);\n const diacritics = target.dictionary[lowerCaseChar] || '';\n [...diacritics]\n .forEach(diacritic => {\n insensitiveMatcher.add(diacritic);\n insensitiveMatcher.add(diacritic.toUpperCase());\n });\n\n return [...insensitiveMatcher].sort().join('');\n }\n}\n\nexport default DiacriticInsensitiveMatcherHandler;","import DiacriticAbstractHandler from './diacritic-abstract-handler.class';\nimport DiacriticMapperInterface from '../interfaces/diacritic-mapper.interface';\n\nclass DiacriticValidatorHandler extends DiacriticAbstractHandler {\n protected diacriticTrap(target: DiacriticMapperInterface, char: string): RegExp {\n super.diacriticTrap(target, char);\n const diacritics = target.dictionary[char.toLowerCase()];\n let matchingDiacritics = '';\n if (diacritics) {\n matchingDiacritics = target.isUpperCase(char) ? diacritics.toUpperCase() : diacritics;\n }\n return new RegExp(`[${char}${matchingDiacritics}]`, 'u');\n }\n}\n\nexport default DiacriticValidatorHandler;","import DiacriticAbstractHandler from './diacritic-abstract-handler.class';\nimport DiacriticMapperInterface from '../interfaces/diacritic-mapper.interface';\n\nclass DiacriticInsensitiveValidatorHandler extends DiacriticAbstractHandler {\n protected diacriticTrap(target: DiacriticMapperInterface, char: string): RegExp {\n super.diacriticTrap(target, char);\n return new RegExp(`[${char}${target.insensitiveMatcher[char] || ''}]`, 'ui');\n }\n}\n\nexport default DiacriticInsensitiveValidatorHandler;","import DiacriticSetInterface from '../interfaces/diacritic-set.interface';\nimport DiacriticValidatorSetInterface from '../interfaces/diacritic-validator-set.interface';\nimport DiacriticMapperInterface from '../interfaces/diacritic-mapper.interface';\nimport DiacriticMatcherHandler from './diacritic-matcher-handler.class';\nimport DiacriticInsensitiveMatcherHandler from './diacritic-insensitive-matcher-handler.class';\nimport DiacriticValidatorHandler from './diacritic-validator-handler.class';\nimport DiacriticInsensitiveValidatorHandler from './diacritic-insensitive-validator-handler.class';\nimport { isString } from 'util';\n\nclass DiacriticMapperCore implements DiacriticMapperInterface {\n\n [key:string]: string|any;\n\n public dictionary: DiacriticSetInterface;\n public matcher: DiacriticSetInterface;\n\n public insensitiveMatcher: DiacriticSetInterface;\n\n public validator: DiacriticValidatorSetInterface;\n\n public insensitiveValidator: DiacriticValidatorSetInterface;\n\n public constructor(dictionaries: DiacriticSetInterface[]) {\n const dictionary = dictionaries\n .reduce((\n dictMerge: DiacriticSetInterface,\n currentDict: DiacriticSetInterface\n ) => Object.entries(currentDict)\n .reduce((accumulator: DiacriticSetInterface, [letter, diacritics]) => ({\n ...accumulator,\n [letter]: (accumulator[letter] || '') + diacritics\n }), dictMerge),\n {});\n\n Object.entries(dictionary)\n .forEach(([letter, diacritics]) => {\n dictionary[letter] = [...(new Set([...diacritics]))].sort().join('');\n });\n\n this.dictionary = Object.freeze(dictionary);\n this.matcher = new Proxy(this, new DiacriticMatcherHandler());\n this.insensitiveMatcher = new Proxy(this, new DiacriticInsensitiveMatcherHandler());\n this.validator = new Proxy(this, new DiacriticValidatorHandler());\n this.insensitiveValidator = new Proxy(this, new DiacriticInsensitiveValidatorHandler());\n }\n\n public matcherBy(regexp: RegExp): string {\n const lowerCase = Object.entries(this.dictionary)\n .filter(([key, value]) => value && regexp.test(key))\n .map(([char ,value]) => char + value);\n\n const upperCase = Object.entries(this.dictionary)\n .filter(([key, value]) => value && regexp.test(key.toUpperCase()))\n .map(([char ,value]) => (char + value).toUpperCase());\n\n return [...lowerCase, ...upperCase].join('');\n }\n\n public replace(text: string): string {\n return text.replace(/./g, (char: string) => this[char]);\n }\n\n /**\n * Check if the given string is uppercase\n *\n * @param {string} [text=''] string to check\n * @returns {boolean} true if text is uppercase\n * @memberof DiacriticMapperCore\n */\n public isUpperCase(text: string = ''): boolean {\n return text.toUpperCase() === text;\n }\n\n /**\n * Check if the given string is lowercase\n *\n * @param {string} [text=''] string to check\n * @returns {boolean} true if text is lowercase\n * @memberof DiacriticMapperCore\n */\n public isLowerCase(text: string = ''): boolean {\n return text.toLowerCase() === text;\n }\n}\n\nexport default DiacriticMapperCore;","/**\n * i18n jsons and i18n-all.ts use material from Wikipedia\n * Article: https://en.wikipedia.org/wiki/Diacritic\n * License: CC-BY-SA 3.0\n */\nexport default {\n \"a\": \"áäâàåÄąāãă\",\n \"e\": \"éèêëěÊęėēё\",\n \"i\": \"íîïi̇řìįī\",\n \"o\": \"óôöòøōõơ\",\n \"u\": \"úûüùůŭųūư\",\n \"y\": \"ýÿŷỳ\",\n \"n\": \"ñňŋņń\",\n \"l\": \"ḷŀłļĺľ\",\n \"h\": \"ḥĥȟħ\",\n \"c\": \"çčćĉĊ\",\n \"g\": \"ğĝǧģĠġ\",\n \"s\": \"şšŝṣșſś\",\n \"у\": \"ў\",\n \"и\": \"йѝ\",\n \"е\": \"ё\",\n \"d\": \"đďðḏ\",\n \"z\": \"žŻźż\",\n \"t\": \"ťțțṭ\",\n \"w\": \"ẅŵẃẁ\",\n \"ae\": \"æ\",\n \"ss\": \"ß\",\n \"α\": \"ά\",\n \"ε\": \"έ\",\n \"η\": \"ή\",\n \"ι\": \"ίΐϊ\",\n \"ο\": \"ό\",\n \"υ\": \"ύΰϋ\",\n \"ω\": \"ώ\",\n \"j\": \"ĵ\",\n \"oe\": \"œ\",\n \"\": \"ʰ'ʼ·׳\",\n \"ii\": \"î\",\n \"k\": \"ķ\",\n \"к\": \"ќ\",\n \"г\": \"ѓґ\",\n \"ij\": \"ij\",\n \"r\": \"ŕ\",\n \"і\": \"ї\"\n};","import DiacriticRemoverHandler from './diacritic-remover-handler.class';\nimport DiacriticSetInterface from '../interfaces/diacritic-set.interface';\nimport DiacriticMapperCore from './diacritic-mapper-core.class';\n\nimport I18N_ALL from '../i18n/i18n-all.const';\n\nclass DiacriticRemover extends DiacriticMapperCore {\n [letter: string]: string|any;\n constructor(...dictionaries: DiacriticSetInterface[]) {\n super(dictionaries.length ? dictionaries : [I18N_ALL as DiacriticSetInterface]);\n Object.defineProperty(this, 'dictionary', {\n enumerable: false,\n configurable: false\n });\n return new Proxy(this, new DiacriticRemoverHandler());\n }\n}\nexport default DiacriticRemover;"],"names":["isString","arg","DiacriticAbstractHandler","[object Object]","target","prop","receiver","length","this","diacriticTrap","Reflect","get","char","DiacriticRemoverHandler","super","upperCase","isUpperCase","lowerCaseChar","toLowerCase","plainChar","Object","entries","dictionary","find","diacritics","includes","toUpperCase","DiacriticMatcherHandler","matcher","DiacriticInsensitiveMatcherHandler","insensitiveMatcher","Set","forEach","diacritic","add","sort","join","DiacriticValidatorHandler","matchingDiacritics","RegExp","DiacriticInsensitiveValidatorHandler","DiacriticMapperCore","dictionaries","reduce","dictMerge","currentDict","accumulator","letter","freeze","Proxy","validator","insensitiveValidator","regexp","filter","key","value","test","map","text","replace","a","e","i","o","u","y","n","l","h","c","g","s","у","и","е","d","z","t","w","ae","ss","α","ε","η","ι","ο","υ","ω","j","oe","ii","k","к","г","ij","r","і","I18N_ALL","defineProperty","enumerable","configurable"],"mappings":";;;;;;;;;AAmdO,SAASA,EAASC,GACvB,MAAsB,iBAARA,ECjdhB,MAAeC,EACXC,IAAIC,EAAkCC,EAAmBC,GACrD,OAAIN,EAASK,IAASA,EAAKE,QAAU,EAC1BC,KAAKC,cAAcL,EAAQC,GAE/BK,QAAQC,IAAIP,EAAQC,EAAMC,GAG3BH,cAAcC,EAAkCQ,GACtD,OAAOA,GCRf,MAAMC,UAAgCX,EACxBC,cAAcC,EAAkCQ,GACtDE,MAAML,cAAcL,EAAQQ,GAC5B,MAAMG,EAAqBX,EAAOY,YAAYJ,GACxCK,EAAgBL,EAAKM,eAEpBC,GAAaC,OAAOC,QAAQjB,EAAOkB,YACrCC,KAAK,GAAIC,KAAgBxB,EAASwB,IAAeA,EAAWC,SAASR,KAAmB,GAC7F,OAAIF,GAAaI,EACNA,EAAUO,cAEd1B,EAASmB,GAAaA,EAAYP,GCZjD,MAAMe,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A+BvD,EAE3BtC,eAAeuC,GAMX,OALA5B,MAAM4B,EAAanC,OAASmC,EAAe,CAACuD,IAC5C7E,OAAO8E,eAAe1F,KAAM,aAAc,CACtC2F,YAAY,EACZC,cAAc,IAEX,IAAInD,MAAMzC,KAAM,IAAIK"} \ No newline at end of file diff --git a/dist/diacritic-remover.js b/dist/diacritic-remover.js index 89b869a..c2c1c17 100644 --- a/dist/diacritic-remover.js +++ b/dist/diacritic-remover.js @@ -1,5 +1,5 @@ /** - * @marketto/diacritic-remover 1.0.2 + * @marketto/diacritic-remover 1.0.3 * Copyright (c) 2019, Marco Ricupero * License: MIT * ============================================================ @@ -7,5 +7,5 @@ * Article: https://en.wikipedia.org/wiki/Diacritic * License: CC-BY-SA 3.0 */ -"use strict";function isString(i){return"string"==typeof i}class DiacriticAbstractHandler{get(i,e,r){return isString(e)&&1===e.length?this.diacriticTrap(i,e):Reflect.get(i,e,r)}has(i,e){return isString(e)&&1===e.length||Reflect.has(i,e)}diacriticTrap(i,e){}}class DiacriticRemoverHandler extends DiacriticAbstractHandler{diacriticTrap(i,e){super.diacriticTrap(i,e);const r=i.isUpperCase(e),t=e.toLowerCase(),a=Object.keys(i.dictionary).find(e=>isString(i.dictionary[e])&&i.dictionary[e].includes(t));return r&&a?a.toUpperCase():a||e}}class DiacriticMatcherHandler extends DiacriticAbstractHandler{diacriticTrap(i,e){super.diacriticTrap(i,e);const r=i.dictionary[e.toLowerCase()];return r?i.isUpperCase(e)?r.toUpperCase():r:e}}class DiacriticInsensitiveMatcherHandler extends DiacriticAbstractHandler{diacriticTrap(i,e){super.diacriticTrap(i,e);const r=i.dictionary[e.toLowerCase()];return r?r+r.toUpperCase():e}}class DiacriticValidatorHandler extends DiacriticAbstractHandler{diacriticTrap(i,e){super.diacriticTrap(i,e);const r=i.dictionary[e.toLowerCase()];let t="";return r&&(t=i.isUpperCase(e)?r.toUpperCase():r),new RegExp(`[${e}${t}]`,"u")}}class DiacriticInsensitiveValidatorHandler extends DiacriticAbstractHandler{diacriticTrap(i,e){return super.diacriticTrap(i,e),new RegExp(`[${e}${i.insensitiveMatcher[e]||""}]`,"ui")}}class DiacriticMapperCore{constructor(i){const e=i.reduce((i,e)=>(Object.entries(e).forEach(([e,r])=>{if(isString(r))if(e in i){const t=r.split("").filter(r=>!i[e].includes(r)).join("");i[e]+=t}else i[e]=r}),i),{});this.dictionary=Object.freeze(e),this.matcher=new Proxy(this,new DiacriticMatcherHandler),this.insensitiveMatcher=new Proxy(this,new DiacriticInsensitiveMatcherHandler),this.validator=new Proxy(this,new DiacriticValidatorHandler),this.insensitiveValidator=new Proxy(this,new DiacriticInsensitiveValidatorHandler)}matcherBy(i){return[...Object.entries(this.dictionary).filter(([e,r])=>r&&i.test(e)).map(([,i])=>i),...Object.entries(this.dictionary).filter(([e,r])=>r&&i.test(e.toUpperCase())).map(([,i])=>i.toUpperCase())].join("")}replace(i){return i.replace(/./g,i=>this[i])}isUpperCase(i=""){return i.toUpperCase()===i}isLowerCase(i=""){return i.toLowerCase()===i}}var I18N_ALL={a:"áäâàåÄąāãă",e:"éèêëěÊęėēё",i:"íîïi̇řìįī",o:"óôöòøōõơ",u:"úûüùůŭųūư",y:"ýÿŷỳ",n:"ñňŋņń",l:"ḷŀłļĺľ",h:"ḥĥȟħ",c:"çčćĉĊ",g:"ğĝǧģĠġ",s:"şšŝṣșſś","у":"ў","и":"йѝ","е":"ё",d:"đďðḏ",z:"žŻźż",t:"ťțțṭ",w:"ẅŵẃẁ",ae:"æ",ss:"ß","α":"ά","ε":"έ","η":"ή","ι":"ίΐϊ","ο":"ό","υ":"ύΰϋ","ω":"ώ",j:"ĵ",oe:"œ","":"ʰ'ʼ·׳",ii:"î",k:"ķ","к":"ќ","г":"ѓґ",ij:"ij",r:"ŕ","і":"ї"};class DiacriticRemover extends DiacriticMapperCore{constructor(...i){return super(i.length?i:[I18N_ALL]),Object.defineProperty(this,"dictionary",{enumerable:!1,configurable:!1}),new Proxy(this,new DiacriticRemoverHandler)}}module.exports=DiacriticRemover; +"use strict";function isString(e){return"string"==typeof e}class DiacriticAbstractHandler{get(e,i,r){return isString(i)&&i.length<=1?this.diacriticTrap(e,i):Reflect.get(e,i,r)}diacriticTrap(e,i){return i}}class DiacriticRemoverHandler extends DiacriticAbstractHandler{diacriticTrap(e,i){super.diacriticTrap(e,i);const r=e.isUpperCase(i),t=i.toLowerCase(),[a]=Object.entries(e.dictionary).find(([,e])=>isString(e)&&e.includes(t))||[];return r&&a?a.toUpperCase():isString(a)?a:i}}class DiacriticMatcherHandler extends DiacriticAbstractHandler{diacriticTrap(e,i){let r=super.diacriticTrap(e,i);const t=e.dictionary[i.toLowerCase()];return t&&(r+=e.isUpperCase(r)?t.toUpperCase():t),r}}class DiacriticInsensitiveMatcherHandler extends DiacriticAbstractHandler{diacriticTrap(e,i){const r=super.diacriticTrap(e,i).toLowerCase(),t=new Set([r,r.toUpperCase()]);return[...e.dictionary[r]||""].forEach(e=>{t.add(e),t.add(e.toUpperCase())}),[...t].sort().join("")}}class DiacriticValidatorHandler extends DiacriticAbstractHandler{diacriticTrap(e,i){super.diacriticTrap(e,i);const r=e.dictionary[i.toLowerCase()];let t="";return r&&(t=e.isUpperCase(i)?r.toUpperCase():r),new RegExp(`[${i}${t}]`,"u")}}class DiacriticInsensitiveValidatorHandler extends DiacriticAbstractHandler{diacriticTrap(e,i){return super.diacriticTrap(e,i),new RegExp(`[${i}${e.insensitiveMatcher[i]||""}]`,"ui")}}class DiacriticMapperCore{constructor(e){const i=e.reduce((e,i)=>Object.entries(i).reduce((e,[i,r])=>Object.assign(Object.assign({},e),{[i]:(e[i]||"")+r}),e),{});Object.entries(i).forEach(([e,r])=>{i[e]=[...new Set([...r])].sort().join("")}),this.dictionary=Object.freeze(i),this.matcher=new Proxy(this,new DiacriticMatcherHandler),this.insensitiveMatcher=new Proxy(this,new DiacriticInsensitiveMatcherHandler),this.validator=new Proxy(this,new DiacriticValidatorHandler),this.insensitiveValidator=new Proxy(this,new DiacriticInsensitiveValidatorHandler)}matcherBy(e){return[...Object.entries(this.dictionary).filter(([i,r])=>r&&e.test(i)).map(([e,i])=>e+i),...Object.entries(this.dictionary).filter(([i,r])=>r&&e.test(i.toUpperCase())).map(([e,i])=>(e+i).toUpperCase())].join("")}replace(e){return e.replace(/./g,e=>this[e])}isUpperCase(e=""){return e.toUpperCase()===e}isLowerCase(e=""){return e.toLowerCase()===e}}var I18N_ALL={a:"áäâàåÄąāãă",e:"éèêëěÊęėēё",i:"íîïi̇řìįī",o:"óôöòøōõơ",u:"úûüùůŭųūư",y:"ýÿŷỳ",n:"ñňŋņń",l:"ḷŀłļĺľ",h:"ḥĥȟħ",c:"çčćĉĊ",g:"ğĝǧģĠġ",s:"şšŝṣșſś","у":"ў","и":"йѝ","е":"ё",d:"đďðḏ",z:"žŻźż",t:"ťțțṭ",w:"ẅŵẃẁ",ae:"æ",ss:"ß","α":"ά","ε":"έ","η":"ή","ι":"ίΐϊ","ο":"ό","υ":"ύΰϋ","ω":"ώ",j:"ĵ",oe:"œ","":"ʰ'ʼ·׳",ii:"î",k:"ķ","к":"ќ","г":"ѓґ",ij:"ij",r:"ŕ","і":"ї"};class DiacriticRemover extends DiacriticMapperCore{constructor(...e){return super(e.length?e:[I18N_ALL]),Object.defineProperty(this,"dictionary",{enumerable:!1,configurable:!1}),new Proxy(this,new DiacriticRemoverHandler)}}module.exports=DiacriticRemover; //# sourceMappingURL=diacritic-remover.js.map diff --git a/dist/diacritic-remover.js.map b/dist/diacritic-remover.js.map index 2dafe8a..28cc064 100644 --- a/dist/diacritic-remover.js.map +++ b/dist/diacritic-remover.js.map @@ -1 +1 @@ -{"version":3,"file":"diacritic-remover.js","sources":["../node_modules/rollup-plugin-node-builtins/src/es6/util.js","../src/classes/diacritic-abstract-handler.class.ts","../src/classes/diacritic-remover-handler.class.ts","../src/classes/diacritic-matcher-handler.class.ts","../src/classes/diacritic-insensitive-matcher-handler.class.ts","../src/classes/diacritic-validator-handler.class.ts","../src/classes/diacritic-insensitive-validator-handler.class.ts","../src/classes/diacritic-mapper-core.class.ts","../src/i18n/i18n-all.const.ts","../src/classes/diacritic-remover.class.ts"],"sourcesContent":["// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\nimport process from 'process';\nvar formatRegExp = /%[sdj%]/g;\nexport function format(f) {\n if (!isString(f)) {\n var objects = [];\n for (var i = 0; i < arguments.length; i++) {\n objects.push(inspect(arguments[i]));\n }\n return objects.join(' ');\n }\n\n var i = 1;\n var args = arguments;\n var len = args.length;\n var str = String(f).replace(formatRegExp, function(x) {\n if (x === '%%') return '%';\n if (i >= len) return x;\n switch (x) {\n case '%s': return String(args[i++]);\n case '%d': return Number(args[i++]);\n case '%j':\n try {\n return JSON.stringify(args[i++]);\n } catch (_) {\n return '[Circular]';\n }\n default:\n return x;\n }\n });\n for (var x = args[i]; i < len; x = args[++i]) {\n if (isNull(x) || !isObject(x)) {\n str += ' ' + x;\n } else {\n str += ' ' + inspect(x);\n }\n }\n return str;\n};\n\n\n// Mark that a method should not be used.\n// Returns a modified function which warns once by default.\n// If --no-deprecation is set, then it is a no-op.\nexport function deprecate(fn, msg) {\n // Allow for deprecating things in the process of starting up.\n if (isUndefined(global.process)) {\n return function() {\n return deprecate(fn, msg).apply(this, arguments);\n };\n }\n\n if (process.noDeprecation === true) {\n return fn;\n }\n\n var warned = false;\n function deprecated() {\n if (!warned) {\n if (process.throwDeprecation) {\n throw new Error(msg);\n } else if (process.traceDeprecation) {\n console.trace(msg);\n } else {\n console.error(msg);\n }\n warned = true;\n }\n return fn.apply(this, arguments);\n }\n\n return deprecated;\n};\n\n\nvar debugs = {};\nvar debugEnviron;\nexport function debuglog(set) {\n if (isUndefined(debugEnviron))\n debugEnviron = process.env.NODE_DEBUG || '';\n set = set.toUpperCase();\n if (!debugs[set]) {\n if (new RegExp('\\\\b' + set + '\\\\b', 'i').test(debugEnviron)) {\n var pid = 0;\n debugs[set] = function() {\n var msg = format.apply(null, arguments);\n console.error('%s %d: %s', set, pid, msg);\n };\n } else {\n debugs[set] = function() {};\n }\n }\n return debugs[set];\n};\n\n\n/**\n * Echos the value of a value. Trys to print the value out\n * in the best way possible given the different types.\n *\n * @param {Object} obj The object to print out.\n * @param {Object} opts Optional options object that alters the output.\n */\n/* legacy: obj, showHidden, depth, colors*/\nexport function inspect(obj, opts) {\n // default options\n var ctx = {\n seen: [],\n stylize: stylizeNoColor\n };\n // legacy...\n if (arguments.length >= 3) ctx.depth = arguments[2];\n if (arguments.length >= 4) ctx.colors = arguments[3];\n if (isBoolean(opts)) {\n // legacy...\n ctx.showHidden = opts;\n } else if (opts) {\n // got an \"options\" object\n _extend(ctx, opts);\n }\n // set default options\n if (isUndefined(ctx.showHidden)) ctx.showHidden = false;\n if (isUndefined(ctx.depth)) ctx.depth = 2;\n if (isUndefined(ctx.colors)) ctx.colors = false;\n if (isUndefined(ctx.customInspect)) ctx.customInspect = true;\n if (ctx.colors) ctx.stylize = stylizeWithColor;\n return formatValue(ctx, obj, ctx.depth);\n}\n\n// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics\ninspect.colors = {\n 'bold' : [1, 22],\n 'italic' : [3, 23],\n 'underline' : [4, 24],\n 'inverse' : [7, 27],\n 'white' : [37, 39],\n 'grey' : [90, 39],\n 'black' : [30, 39],\n 'blue' : [34, 39],\n 'cyan' : [36, 39],\n 'green' : [32, 39],\n 'magenta' : [35, 39],\n 'red' : [31, 39],\n 'yellow' : [33, 39]\n};\n\n// Don't use 'blue' not visible on cmd.exe\ninspect.styles = {\n 'special': 'cyan',\n 'number': 'yellow',\n 'boolean': 'yellow',\n 'undefined': 'grey',\n 'null': 'bold',\n 'string': 'green',\n 'date': 'magenta',\n // \"name\": intentionally not styling\n 'regexp': 'red'\n};\n\n\nfunction stylizeWithColor(str, styleType) {\n var style = inspect.styles[styleType];\n\n if (style) {\n return '\\u001b[' + inspect.colors[style][0] + 'm' + str +\n '\\u001b[' + inspect.colors[style][1] + 'm';\n } else {\n return str;\n }\n}\n\n\nfunction stylizeNoColor(str, styleType) {\n return str;\n}\n\n\nfunction arrayToHash(array) {\n var hash = {};\n\n array.forEach(function(val, idx) {\n hash[val] = true;\n });\n\n return hash;\n}\n\n\nfunction formatValue(ctx, value, recurseTimes) {\n // Provide a hook for user-specified inspect functions.\n // Check that value is an object with an inspect function on it\n if (ctx.customInspect &&\n value &&\n isFunction(value.inspect) &&\n // Filter out the util module, it's inspect function is special\n value.inspect !== inspect &&\n // Also filter out any prototype objects using the circular check.\n !(value.constructor && value.constructor.prototype === value)) {\n var ret = value.inspect(recurseTimes, ctx);\n if (!isString(ret)) {\n ret = formatValue(ctx, ret, recurseTimes);\n }\n return ret;\n }\n\n // Primitive types cannot have properties\n var primitive = formatPrimitive(ctx, value);\n if (primitive) {\n return primitive;\n }\n\n // Look up the keys of the object.\n var keys = Object.keys(value);\n var visibleKeys = arrayToHash(keys);\n\n if (ctx.showHidden) {\n keys = Object.getOwnPropertyNames(value);\n }\n\n // IE doesn't make error fields non-enumerable\n // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx\n if (isError(value)\n && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {\n return formatError(value);\n }\n\n // Some type of object without properties can be shortcutted.\n if (keys.length === 0) {\n if (isFunction(value)) {\n var name = value.name ? ': ' + value.name : '';\n return ctx.stylize('[Function' + name + ']', 'special');\n }\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n }\n if (isDate(value)) {\n return ctx.stylize(Date.prototype.toString.call(value), 'date');\n }\n if (isError(value)) {\n return formatError(value);\n }\n }\n\n var base = '', array = false, braces = ['{', '}'];\n\n // Make Array say that they are Array\n if (isArray(value)) {\n array = true;\n braces = ['[', ']'];\n }\n\n // Make functions say that they are functions\n if (isFunction(value)) {\n var n = value.name ? ': ' + value.name : '';\n base = ' [Function' + n + ']';\n }\n\n // Make RegExps say that they are RegExps\n if (isRegExp(value)) {\n base = ' ' + RegExp.prototype.toString.call(value);\n }\n\n // Make dates with properties first say the date\n if (isDate(value)) {\n base = ' ' + Date.prototype.toUTCString.call(value);\n }\n\n // Make error with message first say the error\n if (isError(value)) {\n base = ' ' + formatError(value);\n }\n\n if (keys.length === 0 && (!array || value.length == 0)) {\n return braces[0] + base + braces[1];\n }\n\n if (recurseTimes < 0) {\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n } else {\n return ctx.stylize('[Object]', 'special');\n }\n }\n\n ctx.seen.push(value);\n\n var output;\n if (array) {\n output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);\n } else {\n output = keys.map(function(key) {\n return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);\n });\n }\n\n ctx.seen.pop();\n\n return reduceToSingleString(output, base, braces);\n}\n\n\nfunction formatPrimitive(ctx, value) {\n if (isUndefined(value))\n return ctx.stylize('undefined', 'undefined');\n if (isString(value)) {\n var simple = '\\'' + JSON.stringify(value).replace(/^\"|\"$/g, '')\n .replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"') + '\\'';\n return ctx.stylize(simple, 'string');\n }\n if (isNumber(value))\n return ctx.stylize('' + value, 'number');\n if (isBoolean(value))\n return ctx.stylize('' + value, 'boolean');\n // For some reason typeof null is \"object\", so special case here.\n if (isNull(value))\n return ctx.stylize('null', 'null');\n}\n\n\nfunction formatError(value) {\n return '[' + Error.prototype.toString.call(value) + ']';\n}\n\n\nfunction formatArray(ctx, value, recurseTimes, visibleKeys, keys) {\n var output = [];\n for (var i = 0, l = value.length; i < l; ++i) {\n if (hasOwnProperty(value, String(i))) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n String(i), true));\n } else {\n output.push('');\n }\n }\n keys.forEach(function(key) {\n if (!key.match(/^\\d+$/)) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n key, true));\n }\n });\n return output;\n}\n\n\nfunction formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {\n var name, str, desc;\n desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };\n if (desc.get) {\n if (desc.set) {\n str = ctx.stylize('[Getter/Setter]', 'special');\n } else {\n str = ctx.stylize('[Getter]', 'special');\n }\n } else {\n if (desc.set) {\n str = ctx.stylize('[Setter]', 'special');\n }\n }\n if (!hasOwnProperty(visibleKeys, key)) {\n name = '[' + key + ']';\n }\n if (!str) {\n if (ctx.seen.indexOf(desc.value) < 0) {\n if (isNull(recurseTimes)) {\n str = formatValue(ctx, desc.value, null);\n } else {\n str = formatValue(ctx, desc.value, recurseTimes - 1);\n }\n if (str.indexOf('\\n') > -1) {\n if (array) {\n str = str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n').substr(2);\n } else {\n str = '\\n' + str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n');\n }\n }\n } else {\n str = ctx.stylize('[Circular]', 'special');\n }\n }\n if (isUndefined(name)) {\n if (array && key.match(/^\\d+$/)) {\n return str;\n }\n name = JSON.stringify('' + key);\n if (name.match(/^\"([a-zA-Z_][a-zA-Z_0-9]*)\"$/)) {\n name = name.substr(1, name.length - 2);\n name = ctx.stylize(name, 'name');\n } else {\n name = name.replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"')\n .replace(/(^\"|\"$)/g, \"'\");\n name = ctx.stylize(name, 'string');\n }\n }\n\n return name + ': ' + str;\n}\n\n\nfunction reduceToSingleString(output, base, braces) {\n var numLinesEst = 0;\n var length = output.reduce(function(prev, cur) {\n numLinesEst++;\n if (cur.indexOf('\\n') >= 0) numLinesEst++;\n return prev + cur.replace(/\\u001b\\[\\d\\d?m/g, '').length + 1;\n }, 0);\n\n if (length > 60) {\n return braces[0] +\n (base === '' ? '' : base + '\\n ') +\n ' ' +\n output.join(',\\n ') +\n ' ' +\n braces[1];\n }\n\n return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];\n}\n\n\n// NOTE: These type checking functions intentionally don't use `instanceof`\n// because it is fragile and can be easily faked with `Object.create()`.\nexport function isArray(ar) {\n return Array.isArray(ar);\n}\n\nexport function isBoolean(arg) {\n return typeof arg === 'boolean';\n}\n\nexport function isNull(arg) {\n return arg === null;\n}\n\nexport function isNullOrUndefined(arg) {\n return arg == null;\n}\n\nexport function isNumber(arg) {\n return typeof arg === 'number';\n}\n\nexport function isString(arg) {\n return typeof arg === 'string';\n}\n\nexport function isSymbol(arg) {\n return typeof arg === 'symbol';\n}\n\nexport function isUndefined(arg) {\n return arg === void 0;\n}\n\nexport function isRegExp(re) {\n return isObject(re) && objectToString(re) === '[object RegExp]';\n}\n\nexport function isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\n\nexport function isDate(d) {\n return isObject(d) && objectToString(d) === '[object Date]';\n}\n\nexport function isError(e) {\n return isObject(e) &&\n (objectToString(e) === '[object Error]' || e instanceof Error);\n}\n\nexport function isFunction(arg) {\n return typeof arg === 'function';\n}\n\nexport function isPrimitive(arg) {\n return arg === null ||\n typeof arg === 'boolean' ||\n typeof arg === 'number' ||\n typeof arg === 'string' ||\n typeof arg === 'symbol' || // ES6 symbol\n typeof arg === 'undefined';\n}\n\nexport function isBuffer(maybeBuf) {\n return Buffer.isBuffer(maybeBuf);\n}\n\nfunction objectToString(o) {\n return Object.prototype.toString.call(o);\n}\n\n\nfunction pad(n) {\n return n < 10 ? '0' + n.toString(10) : n.toString(10);\n}\n\n\nvar months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',\n 'Oct', 'Nov', 'Dec'];\n\n// 26 Feb 16:19:34\nfunction timestamp() {\n var d = new Date();\n var time = [pad(d.getHours()),\n pad(d.getMinutes()),\n pad(d.getSeconds())].join(':');\n return [d.getDate(), months[d.getMonth()], time].join(' ');\n}\n\n\n// log is just a thin wrapper to console.log that prepends a timestamp\nexport function log() {\n console.log('%s - %s', timestamp(), format.apply(null, arguments));\n}\n\n\n/**\n * Inherit the prototype methods from one constructor into another.\n *\n * The Function.prototype.inherits from lang.js rewritten as a standalone\n * function (not on Function.prototype). NOTE: If this file is to be loaded\n * during bootstrapping this function needs to be rewritten using some native\n * functions as prototype setup using normal JavaScript does not work as\n * expected during bootstrapping (see mirror.js in r114903).\n *\n * @param {function} ctor Constructor function which needs to inherit the\n * prototype.\n * @param {function} superCtor Constructor function to inherit prototype from.\n */\nimport inherits from './inherits';\nexport {inherits}\n\nexport function _extend(origin, add) {\n // Don't do anything if add isn't an object\n if (!add || !isObject(add)) return origin;\n\n var keys = Object.keys(add);\n var i = keys.length;\n while (i--) {\n origin[keys[i]] = add[keys[i]];\n }\n return origin;\n};\n\nfunction hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\nexport default {\n inherits: inherits,\n _extend: _extend,\n log: log,\n isBuffer: isBuffer,\n isPrimitive: isPrimitive,\n isFunction: isFunction,\n isError: isError,\n isDate: isDate,\n isObject: isObject,\n isRegExp: isRegExp,\n isUndefined: isUndefined,\n isSymbol: isSymbol,\n isString: isString,\n isNumber: isNumber,\n isNullOrUndefined: isNullOrUndefined,\n isNull: isNull,\n isBoolean: isBoolean,\n isArray: isArray,\n inspect: inspect,\n deprecate: deprecate,\n format: format,\n debuglog: debuglog\n}\n","import { isString } from \"util\";\nimport DiacriticMapperInterface from '../interfaces/diacritic-mapper.interface';\n\nabstract class DiacriticAbstractHandler implements ProxyHandler {\n get(target: DiacriticMapperInterface, prop: PropertyKey, receiver: any): any {\n if (isString(prop) && prop.length === 1) {\n return this.diacriticTrap(target, prop);\n }\n return Reflect.get(target, prop, receiver);\n }\n\n has(target: DiacriticMapperInterface, prop: PropertyKey): boolean {\n return (isString(prop) && prop.length === 1) || Reflect.has(target, prop);\n }\n\n protected diacriticTrap(target: DiacriticMapperInterface, char: string): any {\n return;\n }\n}\n\nexport default DiacriticAbstractHandler;","import DiacriticMapperInterface from '../interfaces/diacritic-mapper.interface';\nimport DiacriticAbstractHandler from './diacritic-abstract-handler.class';\nimport { isString } from 'util';\n\nclass DiacriticRemoverHandler extends DiacriticAbstractHandler {\n protected diacriticTrap(target: DiacriticMapperInterface, char: string): string {\n super.diacriticTrap(target, char);\n const upperCase: boolean = target.isUpperCase(char);\n const lowerCaseChar = char.toLowerCase();\n\n const plainChar = Object.keys(target.dictionary)\n .find(c => isString(target.dictionary[c]) && target.dictionary[c].includes(lowerCaseChar));\n if (upperCase && plainChar) {\n return plainChar.toUpperCase();\n }\n return plainChar || char;\n }\n}\n\nexport default DiacriticRemoverHandler;","import DiacriticAbstractHandler from './diacritic-abstract-handler.class';\nimport DiacriticMapperInterface from '../interfaces/diacritic-mapper.interface';\n\nclass DiacriticMatcherHandler extends DiacriticAbstractHandler {\n protected diacriticTrap(target: DiacriticMapperInterface, char: string): string {\n super.diacriticTrap(target, char);\n const diacritics = target.dictionary[char.toLowerCase()];\n if (diacritics) {\n return target.isUpperCase(char) ? diacritics.toUpperCase() : diacritics;\n }\n return char;\n }\n}\n\nexport default DiacriticMatcherHandler;","import DiacriticAbstractHandler from './diacritic-abstract-handler.class';\nimport DiacriticMapperInterface from '../interfaces/diacritic-mapper.interface';\n\nclass DiacriticInsensitiveMatcherHandler extends DiacriticAbstractHandler {\n protected diacriticTrap(target: DiacriticMapperInterface, char: string): string {\n super.diacriticTrap(target, char);\n const diacritics = target.dictionary[char.toLowerCase()];\n return diacritics ? (\n diacritics + diacritics.toUpperCase()\n ) : char;\n }\n}\n\nexport default DiacriticInsensitiveMatcherHandler;","import DiacriticAbstractHandler from './diacritic-abstract-handler.class';\nimport DiacriticMapperInterface from '../interfaces/diacritic-mapper.interface';\n\nclass DiacriticValidatorHandler extends DiacriticAbstractHandler {\n protected diacriticTrap(target: DiacriticMapperInterface, char: string): RegExp {\n super.diacriticTrap(target, char);\n const diacritics = target.dictionary[char.toLowerCase()];\n let matchingDiacritics = '';\n if (diacritics) {\n matchingDiacritics = target.isUpperCase(char) ? diacritics.toUpperCase() : diacritics;\n }\n return new RegExp(`[${char}${matchingDiacritics}]`, 'u');\n }\n}\n\nexport default DiacriticValidatorHandler;","import DiacriticAbstractHandler from './diacritic-abstract-handler.class';\nimport DiacriticMapperInterface from '../interfaces/diacritic-mapper.interface';\n\nclass DiacriticInsensitiveValidatorHandler extends DiacriticAbstractHandler {\n protected diacriticTrap(target: DiacriticMapperInterface, char: string): RegExp {\n super.diacriticTrap(target, char);\n return new RegExp(`[${char}${target.insensitiveMatcher[char] || ''}]`, 'ui');\n }\n}\n\nexport default DiacriticInsensitiveValidatorHandler;","import DiacriticSetInterface from '../interfaces/diacritic-set.interface';\nimport DiacriticValidatorSetInterface from '../interfaces/diacritic-validator-set.interface';\nimport DiacriticMapperInterface from '../interfaces/diacritic-mapper.interface';\nimport DiacriticMatcherHandler from './diacritic-matcher-handler.class';\nimport DiacriticInsensitiveMatcherHandler from './diacritic-insensitive-matcher-handler.class';\nimport DiacriticValidatorHandler from './diacritic-validator-handler.class';\nimport DiacriticInsensitiveValidatorHandler from './diacritic-insensitive-validator-handler.class';\nimport { isString } from 'util';\n\nclass DiacriticMapperCore implements DiacriticMapperInterface {\n\n [key:string]: string|any;\n\n public dictionary: DiacriticSetInterface;\n public matcher: DiacriticSetInterface;\n\n public insensitiveMatcher: DiacriticSetInterface;\n\n public validator: DiacriticValidatorSetInterface;\n\n public insensitiveValidator: DiacriticValidatorSetInterface;\n\n public constructor(dictionaries: DiacriticSetInterface[]) {\n const dictionary = dictionaries.reduce((accumulator: DiacriticSetInterface, currentDict: DiacriticSetInterface) => {\n Object.entries(currentDict).forEach(([letter, diacritics]) => {\n if (isString(diacritics)){\n if (letter in accumulator) {\n const newDiacritics = diacritics.split('').filter(l => !accumulator[letter].includes(l)).join('');\n accumulator[letter] += newDiacritics;\n } else {\n accumulator[letter] = diacritics;\n }\n }\n });\n return accumulator;\n }, {});\n\n this.dictionary = Object.freeze(dictionary);\n this.matcher = new Proxy(this, new DiacriticMatcherHandler());\n this.insensitiveMatcher = new Proxy(this, new DiacriticInsensitiveMatcherHandler());\n this.validator = new Proxy(this, new DiacriticValidatorHandler());\n this.insensitiveValidator = new Proxy(this, new DiacriticInsensitiveValidatorHandler());\n }\n\n public matcherBy(regexp: RegExp): string {\n const lowerCase = Object.entries(this.dictionary)\n .filter(([key, value]) => value && regexp.test(key))\n .map(([,value]) => value);\n\n const upperCase = Object.entries(this.dictionary)\n .filter(([key, value]) => value && regexp.test(key.toUpperCase()))\n .map(([,value]) => value.toUpperCase());\n\n return [...lowerCase, ...upperCase].join('');\n }\n\n public replace(text: string): string {\n return text.replace(/./g, (char: string) => this[char]);\n }\n\n /**\n * Check if the given string is uppercase\n *\n * @param {string} [text=''] string to check\n * @returns {boolean} true if text is uppercase\n * @memberof DiacriticMapperCore\n */\n public isUpperCase(text: string = ''): boolean {\n return text.toUpperCase() === text;\n }\n\n /**\n * Check if the given string is lowercase\n *\n * @param {string} [text=''] string to check\n * @returns {boolean} true if text is lowercase\n * @memberof DiacriticMapperCore\n */\n public isLowerCase(text: string = ''): boolean {\n return text.toLowerCase() === text;\n }\n}\n\nexport default DiacriticMapperCore;","/**\n * i18n jsons and i18n-all.ts use material from Wikipedia\n * Article: https://en.wikipedia.org/wiki/Diacritic\n * License: CC-BY-SA 3.0\n */\nexport default {\n \"a\": \"áäâàåÄąāãă\",\n \"e\": \"éèêëěÊęėēё\",\n \"i\": \"íîïi̇řìįī\",\n \"o\": \"óôöòøōõơ\",\n \"u\": \"úûüùůŭųūư\",\n \"y\": \"ýÿŷỳ\",\n \"n\": \"ñňŋņń\",\n \"l\": \"ḷŀłļĺľ\",\n \"h\": \"ḥĥȟħ\",\n \"c\": \"çčćĉĊ\",\n \"g\": \"ğĝǧģĠġ\",\n \"s\": \"şšŝṣșſś\",\n \"у\": \"ў\",\n \"и\": \"йѝ\",\n \"е\": \"ё\",\n \"d\": \"đďðḏ\",\n \"z\": \"žŻźż\",\n \"t\": \"ťțțṭ\",\n \"w\": \"ẅŵẃẁ\",\n \"ae\": \"æ\",\n \"ss\": \"ß\",\n \"α\": \"ά\",\n \"ε\": \"έ\",\n \"η\": \"ή\",\n \"ι\": \"ίΐϊ\",\n \"ο\": \"ό\",\n \"υ\": \"ύΰϋ\",\n \"ω\": \"ώ\",\n \"j\": \"ĵ\",\n \"oe\": \"œ\",\n \"\": \"ʰ'ʼ·׳\",\n \"ii\": \"î\",\n \"k\": \"ķ\",\n \"к\": \"ќ\",\n \"г\": \"ѓґ\",\n \"ij\": \"ij\",\n \"r\": \"ŕ\",\n \"і\": \"ї\"\n};","import DiacriticRemoverHandler from './diacritic-remover-handler.class';\nimport DiacriticSetInterface from '../interfaces/diacritic-set.interface';\nimport DiacriticMapperCore from './diacritic-mapper-core.class';\n\nimport I18N_ALL from '../i18n/i18n-all.const';\n\nclass DiacriticRemover extends DiacriticMapperCore{\n [letter: string]: string|any;\n constructor(...dictionaries: DiacriticSetInterface[]) {\n super(dictionaries.length ? dictionaries : [I18N_ALL as DiacriticSetInterface]);\n Object.defineProperty(this, 'dictionary', {\n enumerable: false,\n configurable: false\n });\n return new Proxy(this, new DiacriticRemoverHandler());\n }\n}\nexport default DiacriticRemover;"],"names":["isString","arg","DiacriticAbstractHandler","[object Object]","target","prop","receiver","length","this","diacriticTrap","Reflect","get","has","char","DiacriticRemoverHandler","super","upperCase","isUpperCase","lowerCaseChar","toLowerCase","plainChar","Object","keys","dictionary","find","c","includes","toUpperCase","DiacriticMatcherHandler","diacritics","DiacriticInsensitiveMatcherHandler","DiacriticValidatorHandler","matchingDiacritics","RegExp","DiacriticInsensitiveValidatorHandler","insensitiveMatcher","DiacriticMapperCore","dictionaries","reduce","accumulator","currentDict","entries","forEach","letter","newDiacritics","split","filter","l","join","freeze","matcher","Proxy","validator","insensitiveValidator","regexp","key","value","test","map","text","replace","a","e","i","o","u","y","n","h","g","s","у","и","е","d","z","t","w","ae","ss","α","ε","η","ι","ο","υ","ω","j","oe","ii","k","к","г","ij","r","і","DiacriticRemover","I18N_ALL","defineProperty","enumerable","configurable"],"mappings":";;;;;;;;;aAmdO,SAASA,SAASC,GACvB,MAAsB,iBAARA,ECjdhB,MAAeC,yBACXC,IAAIC,EAAkCC,EAAmBC,GACrD,OAAIN,SAASK,IAAyB,IAAhBA,EAAKE,OAChBC,KAAKC,cAAcL,EAAQC,GAE/BK,QAAQC,IAAIP,EAAQC,EAAMC,GAGrCH,IAAIC,EAAkCC,GAClC,OAAQL,SAASK,IAAyB,IAAhBA,EAAKE,QAAiBG,QAAQE,IAAIR,EAAQC,GAG9DF,cAAcC,EAAkCS,KCX9D,MAAMC,gCAAgCZ,yBACxBC,cAAcC,EAAkCS,GACtDE,MAAMN,cAAcL,EAAQS,GAC5B,MAAMG,EAAqBZ,EAAOa,YAAYJ,GACxCK,EAAgBL,EAAKM,cAErBC,EAAYC,OAAOC,KAAKlB,EAAOmB,YAChCC,KAAKC,GAAKzB,SAASI,EAAOmB,WAAWE,KAAOrB,EAAOmB,WAAWE,GAAGC,SAASR,IAC/E,OAAIF,GAAaI,EACNA,EAAUO,cAEdP,GAAaP,GCZ5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,EACZC,cAAc,IAEX,IAAIjD,MAAM3C,KAAM,IAAIM"} \ No newline at end of file +{"version":3,"file":"diacritic-remover.js","sources":["../node_modules/rollup-plugin-node-builtins/src/es6/util.js","../src/classes/diacritic-abstract-handler.class.ts","../src/classes/diacritic-remover-handler.class.ts","../src/classes/diacritic-matcher-handler.class.ts","../src/classes/diacritic-insensitive-matcher-handler.class.ts","../src/classes/diacritic-validator-handler.class.ts","../src/classes/diacritic-insensitive-validator-handler.class.ts","../src/classes/diacritic-mapper-core.class.ts","../src/i18n/i18n-all.const.ts","../src/classes/diacritic-remover.class.ts"],"sourcesContent":["// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\nimport process from 'process';\nvar formatRegExp = /%[sdj%]/g;\nexport function format(f) {\n if (!isString(f)) {\n var objects = [];\n for (var i = 0; i < arguments.length; i++) {\n objects.push(inspect(arguments[i]));\n }\n return objects.join(' ');\n }\n\n var i = 1;\n var args = arguments;\n var len = args.length;\n var str = String(f).replace(formatRegExp, function(x) {\n if (x === '%%') return '%';\n if (i >= len) return x;\n switch (x) {\n case '%s': return String(args[i++]);\n case '%d': return Number(args[i++]);\n case '%j':\n try {\n return JSON.stringify(args[i++]);\n } catch (_) {\n return '[Circular]';\n }\n default:\n return x;\n }\n });\n for (var x = args[i]; i < len; x = args[++i]) {\n if (isNull(x) || !isObject(x)) {\n str += ' ' + x;\n } else {\n str += ' ' + inspect(x);\n }\n }\n return str;\n};\n\n\n// Mark that a method should not be used.\n// Returns a modified function which warns once by default.\n// If --no-deprecation is set, then it is a no-op.\nexport function deprecate(fn, msg) {\n // Allow for deprecating things in the process of starting up.\n if (isUndefined(global.process)) {\n return function() {\n return deprecate(fn, msg).apply(this, arguments);\n };\n }\n\n if (process.noDeprecation === true) {\n return fn;\n }\n\n var warned = false;\n function deprecated() {\n if (!warned) {\n if (process.throwDeprecation) {\n throw new Error(msg);\n } else if (process.traceDeprecation) {\n console.trace(msg);\n } else {\n console.error(msg);\n }\n warned = true;\n }\n return fn.apply(this, arguments);\n }\n\n return deprecated;\n};\n\n\nvar debugs = {};\nvar debugEnviron;\nexport function debuglog(set) {\n if (isUndefined(debugEnviron))\n debugEnviron = process.env.NODE_DEBUG || '';\n set = set.toUpperCase();\n if (!debugs[set]) {\n if (new RegExp('\\\\b' + set + '\\\\b', 'i').test(debugEnviron)) {\n var pid = 0;\n debugs[set] = function() {\n var msg = format.apply(null, arguments);\n console.error('%s %d: %s', set, pid, msg);\n };\n } else {\n debugs[set] = function() {};\n }\n }\n return debugs[set];\n};\n\n\n/**\n * Echos the value of a value. Trys to print the value out\n * in the best way possible given the different types.\n *\n * @param {Object} obj The object to print out.\n * @param {Object} opts Optional options object that alters the output.\n */\n/* legacy: obj, showHidden, depth, colors*/\nexport function inspect(obj, opts) {\n // default options\n var ctx = {\n seen: [],\n stylize: stylizeNoColor\n };\n // legacy...\n if (arguments.length >= 3) ctx.depth = arguments[2];\n if (arguments.length >= 4) ctx.colors = arguments[3];\n if (isBoolean(opts)) {\n // legacy...\n ctx.showHidden = opts;\n } else if (opts) {\n // got an \"options\" object\n _extend(ctx, opts);\n }\n // set default options\n if (isUndefined(ctx.showHidden)) ctx.showHidden = false;\n if (isUndefined(ctx.depth)) ctx.depth = 2;\n if (isUndefined(ctx.colors)) ctx.colors = false;\n if (isUndefined(ctx.customInspect)) ctx.customInspect = true;\n if (ctx.colors) ctx.stylize = stylizeWithColor;\n return formatValue(ctx, obj, ctx.depth);\n}\n\n// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics\ninspect.colors = {\n 'bold' : [1, 22],\n 'italic' : [3, 23],\n 'underline' : [4, 24],\n 'inverse' : [7, 27],\n 'white' : [37, 39],\n 'grey' : [90, 39],\n 'black' : [30, 39],\n 'blue' : [34, 39],\n 'cyan' : [36, 39],\n 'green' : [32, 39],\n 'magenta' : [35, 39],\n 'red' : [31, 39],\n 'yellow' : [33, 39]\n};\n\n// Don't use 'blue' not visible on cmd.exe\ninspect.styles = {\n 'special': 'cyan',\n 'number': 'yellow',\n 'boolean': 'yellow',\n 'undefined': 'grey',\n 'null': 'bold',\n 'string': 'green',\n 'date': 'magenta',\n // \"name\": intentionally not styling\n 'regexp': 'red'\n};\n\n\nfunction stylizeWithColor(str, styleType) {\n var style = inspect.styles[styleType];\n\n if (style) {\n return '\\u001b[' + inspect.colors[style][0] + 'm' + str +\n '\\u001b[' + inspect.colors[style][1] + 'm';\n } else {\n return str;\n }\n}\n\n\nfunction stylizeNoColor(str, styleType) {\n return str;\n}\n\n\nfunction arrayToHash(array) {\n var hash = {};\n\n array.forEach(function(val, idx) {\n hash[val] = true;\n });\n\n return hash;\n}\n\n\nfunction formatValue(ctx, value, recurseTimes) {\n // Provide a hook for user-specified inspect functions.\n // Check that value is an object with an inspect function on it\n if (ctx.customInspect &&\n value &&\n isFunction(value.inspect) &&\n // Filter out the util module, it's inspect function is special\n value.inspect !== inspect &&\n // Also filter out any prototype objects using the circular check.\n !(value.constructor && value.constructor.prototype === value)) {\n var ret = value.inspect(recurseTimes, ctx);\n if (!isString(ret)) {\n ret = formatValue(ctx, ret, recurseTimes);\n }\n return ret;\n }\n\n // Primitive types cannot have properties\n var primitive = formatPrimitive(ctx, value);\n if (primitive) {\n return primitive;\n }\n\n // Look up the keys of the object.\n var keys = Object.keys(value);\n var visibleKeys = arrayToHash(keys);\n\n if (ctx.showHidden) {\n keys = Object.getOwnPropertyNames(value);\n }\n\n // IE doesn't make error fields non-enumerable\n // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx\n if (isError(value)\n && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {\n return formatError(value);\n }\n\n // Some type of object without properties can be shortcutted.\n if (keys.length === 0) {\n if (isFunction(value)) {\n var name = value.name ? ': ' + value.name : '';\n return ctx.stylize('[Function' + name + ']', 'special');\n }\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n }\n if (isDate(value)) {\n return ctx.stylize(Date.prototype.toString.call(value), 'date');\n }\n if (isError(value)) {\n return formatError(value);\n }\n }\n\n var base = '', array = false, braces = ['{', '}'];\n\n // Make Array say that they are Array\n if (isArray(value)) {\n array = true;\n braces = ['[', ']'];\n }\n\n // Make functions say that they are functions\n if (isFunction(value)) {\n var n = value.name ? ': ' + value.name : '';\n base = ' [Function' + n + ']';\n }\n\n // Make RegExps say that they are RegExps\n if (isRegExp(value)) {\n base = ' ' + RegExp.prototype.toString.call(value);\n }\n\n // Make dates with properties first say the date\n if (isDate(value)) {\n base = ' ' + Date.prototype.toUTCString.call(value);\n }\n\n // Make error with message first say the error\n if (isError(value)) {\n base = ' ' + formatError(value);\n }\n\n if (keys.length === 0 && (!array || value.length == 0)) {\n return braces[0] + base + braces[1];\n }\n\n if (recurseTimes < 0) {\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n } else {\n return ctx.stylize('[Object]', 'special');\n }\n }\n\n ctx.seen.push(value);\n\n var output;\n if (array) {\n output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);\n } else {\n output = keys.map(function(key) {\n return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);\n });\n }\n\n ctx.seen.pop();\n\n return reduceToSingleString(output, base, braces);\n}\n\n\nfunction formatPrimitive(ctx, value) {\n if (isUndefined(value))\n return ctx.stylize('undefined', 'undefined');\n if (isString(value)) {\n var simple = '\\'' + JSON.stringify(value).replace(/^\"|\"$/g, '')\n .replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"') + '\\'';\n return ctx.stylize(simple, 'string');\n }\n if (isNumber(value))\n return ctx.stylize('' + value, 'number');\n if (isBoolean(value))\n return ctx.stylize('' + value, 'boolean');\n // For some reason typeof null is \"object\", so special case here.\n if (isNull(value))\n return ctx.stylize('null', 'null');\n}\n\n\nfunction formatError(value) {\n return '[' + Error.prototype.toString.call(value) + ']';\n}\n\n\nfunction formatArray(ctx, value, recurseTimes, visibleKeys, keys) {\n var output = [];\n for (var i = 0, l = value.length; i < l; ++i) {\n if (hasOwnProperty(value, String(i))) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n String(i), true));\n } else {\n output.push('');\n }\n }\n keys.forEach(function(key) {\n if (!key.match(/^\\d+$/)) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n key, true));\n }\n });\n return output;\n}\n\n\nfunction formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {\n var name, str, desc;\n desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };\n if (desc.get) {\n if (desc.set) {\n str = ctx.stylize('[Getter/Setter]', 'special');\n } else {\n str = ctx.stylize('[Getter]', 'special');\n }\n } else {\n if (desc.set) {\n str = ctx.stylize('[Setter]', 'special');\n }\n }\n if (!hasOwnProperty(visibleKeys, key)) {\n name = '[' + key + ']';\n }\n if (!str) {\n if (ctx.seen.indexOf(desc.value) < 0) {\n if (isNull(recurseTimes)) {\n str = formatValue(ctx, desc.value, null);\n } else {\n str = formatValue(ctx, desc.value, recurseTimes - 1);\n }\n if (str.indexOf('\\n') > -1) {\n if (array) {\n str = str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n').substr(2);\n } else {\n str = '\\n' + str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n');\n }\n }\n } else {\n str = ctx.stylize('[Circular]', 'special');\n }\n }\n if (isUndefined(name)) {\n if (array && key.match(/^\\d+$/)) {\n return str;\n }\n name = JSON.stringify('' + key);\n if (name.match(/^\"([a-zA-Z_][a-zA-Z_0-9]*)\"$/)) {\n name = name.substr(1, name.length - 2);\n name = ctx.stylize(name, 'name');\n } else {\n name = name.replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"')\n .replace(/(^\"|\"$)/g, \"'\");\n name = ctx.stylize(name, 'string');\n }\n }\n\n return name + ': ' + str;\n}\n\n\nfunction reduceToSingleString(output, base, braces) {\n var numLinesEst = 0;\n var length = output.reduce(function(prev, cur) {\n numLinesEst++;\n if (cur.indexOf('\\n') >= 0) numLinesEst++;\n return prev + cur.replace(/\\u001b\\[\\d\\d?m/g, '').length + 1;\n }, 0);\n\n if (length > 60) {\n return braces[0] +\n (base === '' ? '' : base + '\\n ') +\n ' ' +\n output.join(',\\n ') +\n ' ' +\n braces[1];\n }\n\n return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];\n}\n\n\n// NOTE: These type checking functions intentionally don't use `instanceof`\n// because it is fragile and can be easily faked with `Object.create()`.\nexport function isArray(ar) {\n return Array.isArray(ar);\n}\n\nexport function isBoolean(arg) {\n return typeof arg === 'boolean';\n}\n\nexport function isNull(arg) {\n return arg === null;\n}\n\nexport function isNullOrUndefined(arg) {\n return arg == null;\n}\n\nexport function isNumber(arg) {\n return typeof arg === 'number';\n}\n\nexport function isString(arg) {\n return typeof arg === 'string';\n}\n\nexport function isSymbol(arg) {\n return typeof arg === 'symbol';\n}\n\nexport function isUndefined(arg) {\n return arg === void 0;\n}\n\nexport function isRegExp(re) {\n return isObject(re) && objectToString(re) === '[object RegExp]';\n}\n\nexport function isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\n\nexport function isDate(d) {\n return isObject(d) && objectToString(d) === '[object Date]';\n}\n\nexport function isError(e) {\n return isObject(e) &&\n (objectToString(e) === '[object Error]' || e instanceof Error);\n}\n\nexport function isFunction(arg) {\n return typeof arg === 'function';\n}\n\nexport function isPrimitive(arg) {\n return arg === null ||\n typeof arg === 'boolean' ||\n typeof arg === 'number' ||\n typeof arg === 'string' ||\n typeof arg === 'symbol' || // ES6 symbol\n typeof arg === 'undefined';\n}\n\nexport function isBuffer(maybeBuf) {\n return Buffer.isBuffer(maybeBuf);\n}\n\nfunction objectToString(o) {\n return Object.prototype.toString.call(o);\n}\n\n\nfunction pad(n) {\n return n < 10 ? '0' + n.toString(10) : n.toString(10);\n}\n\n\nvar months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',\n 'Oct', 'Nov', 'Dec'];\n\n// 26 Feb 16:19:34\nfunction timestamp() {\n var d = new Date();\n var time = [pad(d.getHours()),\n pad(d.getMinutes()),\n pad(d.getSeconds())].join(':');\n return [d.getDate(), months[d.getMonth()], time].join(' ');\n}\n\n\n// log is just a thin wrapper to console.log that prepends a timestamp\nexport function log() {\n console.log('%s - %s', timestamp(), format.apply(null, arguments));\n}\n\n\n/**\n * Inherit the prototype methods from one constructor into another.\n *\n * The Function.prototype.inherits from lang.js rewritten as a standalone\n * function (not on Function.prototype). NOTE: If this file is to be loaded\n * during bootstrapping this function needs to be rewritten using some native\n * functions as prototype setup using normal JavaScript does not work as\n * expected during bootstrapping (see mirror.js in r114903).\n *\n * @param {function} ctor Constructor function which needs to inherit the\n * prototype.\n * @param {function} superCtor Constructor function to inherit prototype from.\n */\nimport inherits from './inherits';\nexport {inherits}\n\nexport function _extend(origin, add) {\n // Don't do anything if add isn't an object\n if (!add || !isObject(add)) return origin;\n\n var keys = Object.keys(add);\n var i = keys.length;\n while (i--) {\n origin[keys[i]] = add[keys[i]];\n }\n return origin;\n};\n\nfunction hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\nexport default {\n inherits: inherits,\n _extend: _extend,\n log: log,\n isBuffer: isBuffer,\n isPrimitive: isPrimitive,\n isFunction: isFunction,\n isError: isError,\n isDate: isDate,\n isObject: isObject,\n isRegExp: isRegExp,\n isUndefined: isUndefined,\n isSymbol: isSymbol,\n isString: isString,\n isNumber: isNumber,\n isNullOrUndefined: isNullOrUndefined,\n isNull: isNull,\n isBoolean: isBoolean,\n isArray: isArray,\n inspect: inspect,\n deprecate: deprecate,\n format: format,\n debuglog: debuglog\n}\n","import { isString } from \"util\";\nimport DiacriticMapperInterface from '../interfaces/diacritic-mapper.interface';\n\nabstract class DiacriticAbstractHandler implements ProxyHandler {\n get(target: DiacriticMapperInterface, prop: PropertyKey, receiver: any): any {\n if (isString(prop) && prop.length <= 1) {\n return this.diacriticTrap(target, prop);\n }\n return Reflect.get(target, prop, receiver);\n }\n\n protected diacriticTrap(target: DiacriticMapperInterface, char: string): any {\n return char;\n }\n}\n\nexport default DiacriticAbstractHandler;","import DiacriticMapperInterface from '../interfaces/diacritic-mapper.interface';\nimport DiacriticAbstractHandler from './diacritic-abstract-handler.class';\nimport { isString } from 'util';\n\nclass DiacriticRemoverHandler extends DiacriticAbstractHandler {\n protected diacriticTrap(target: DiacriticMapperInterface, char: string): string {\n super.diacriticTrap(target, char);\n const upperCase: boolean = target.isUpperCase(char);\n const lowerCaseChar = char.toLowerCase();\n\n const [plainChar] = Object.entries(target.dictionary)\n .find(([, diacritics]) => isString(diacritics) && diacritics.includes(lowerCaseChar)) || [];\n if (upperCase && plainChar) {\n return plainChar.toUpperCase();\n }\n return isString(plainChar) ? plainChar : char;\n }\n}\n\nexport default DiacriticRemoverHandler;","import DiacriticAbstractHandler from './diacritic-abstract-handler.class';\nimport DiacriticMapperInterface from '../interfaces/diacritic-mapper.interface';\n\nclass DiacriticMatcherHandler extends DiacriticAbstractHandler {\n protected diacriticTrap(target: DiacriticMapperInterface, char: string): string {\n let matcher = super.diacriticTrap(target, char);\n\n const diacritics = target.dictionary[char.toLowerCase()];\n if (diacritics) {\n matcher+= target.isUpperCase(matcher) ? diacritics.toUpperCase() : diacritics;\n }\n return matcher;\n }\n}\n\nexport default DiacriticMatcherHandler;","import DiacriticAbstractHandler from './diacritic-abstract-handler.class';\nimport DiacriticMapperInterface from '../interfaces/diacritic-mapper.interface';\n\nclass DiacriticInsensitiveMatcherHandler extends DiacriticAbstractHandler {\n protected diacriticTrap(target: DiacriticMapperInterface, char: string): string {\n const lowerCaseChar = super.diacriticTrap(target, char).toLowerCase();\n const insensitiveMatcher = new Set([lowerCaseChar, lowerCaseChar.toUpperCase()]);\n const diacritics = target.dictionary[lowerCaseChar] || '';\n [...diacritics]\n .forEach(diacritic => {\n insensitiveMatcher.add(diacritic);\n insensitiveMatcher.add(diacritic.toUpperCase());\n });\n\n return [...insensitiveMatcher].sort().join('');\n }\n}\n\nexport default DiacriticInsensitiveMatcherHandler;","import DiacriticAbstractHandler from './diacritic-abstract-handler.class';\nimport DiacriticMapperInterface from '../interfaces/diacritic-mapper.interface';\n\nclass DiacriticValidatorHandler extends DiacriticAbstractHandler {\n protected diacriticTrap(target: DiacriticMapperInterface, char: string): RegExp {\n super.diacriticTrap(target, char);\n const diacritics = target.dictionary[char.toLowerCase()];\n let matchingDiacritics = '';\n if (diacritics) {\n matchingDiacritics = target.isUpperCase(char) ? diacritics.toUpperCase() : diacritics;\n }\n return new RegExp(`[${char}${matchingDiacritics}]`, 'u');\n }\n}\n\nexport default DiacriticValidatorHandler;","import DiacriticAbstractHandler from './diacritic-abstract-handler.class';\nimport DiacriticMapperInterface from '../interfaces/diacritic-mapper.interface';\n\nclass DiacriticInsensitiveValidatorHandler extends DiacriticAbstractHandler {\n protected diacriticTrap(target: DiacriticMapperInterface, char: string): RegExp {\n super.diacriticTrap(target, char);\n return new RegExp(`[${char}${target.insensitiveMatcher[char] || ''}]`, 'ui');\n }\n}\n\nexport default DiacriticInsensitiveValidatorHandler;","import DiacriticSetInterface from '../interfaces/diacritic-set.interface';\nimport DiacriticValidatorSetInterface from '../interfaces/diacritic-validator-set.interface';\nimport DiacriticMapperInterface from '../interfaces/diacritic-mapper.interface';\nimport DiacriticMatcherHandler from './diacritic-matcher-handler.class';\nimport DiacriticInsensitiveMatcherHandler from './diacritic-insensitive-matcher-handler.class';\nimport DiacriticValidatorHandler from './diacritic-validator-handler.class';\nimport DiacriticInsensitiveValidatorHandler from './diacritic-insensitive-validator-handler.class';\nimport { isString } from 'util';\n\nclass DiacriticMapperCore implements DiacriticMapperInterface {\n\n [key:string]: string|any;\n\n public dictionary: DiacriticSetInterface;\n public matcher: DiacriticSetInterface;\n\n public insensitiveMatcher: DiacriticSetInterface;\n\n public validator: DiacriticValidatorSetInterface;\n\n public insensitiveValidator: DiacriticValidatorSetInterface;\n\n public constructor(dictionaries: DiacriticSetInterface[]) {\n const dictionary = dictionaries\n .reduce((\n dictMerge: DiacriticSetInterface,\n currentDict: DiacriticSetInterface\n ) => Object.entries(currentDict)\n .reduce((accumulator: DiacriticSetInterface, [letter, diacritics]) => ({\n ...accumulator,\n [letter]: (accumulator[letter] || '') + diacritics\n }), dictMerge),\n {});\n\n Object.entries(dictionary)\n .forEach(([letter, diacritics]) => {\n dictionary[letter] = [...(new Set([...diacritics]))].sort().join('');\n });\n\n this.dictionary = Object.freeze(dictionary);\n this.matcher = new Proxy(this, new DiacriticMatcherHandler());\n this.insensitiveMatcher = new Proxy(this, new DiacriticInsensitiveMatcherHandler());\n this.validator = new Proxy(this, new DiacriticValidatorHandler());\n this.insensitiveValidator = new Proxy(this, new DiacriticInsensitiveValidatorHandler());\n }\n\n public matcherBy(regexp: RegExp): string {\n const lowerCase = Object.entries(this.dictionary)\n .filter(([key, value]) => value && regexp.test(key))\n .map(([char ,value]) => char + value);\n\n const upperCase = Object.entries(this.dictionary)\n .filter(([key, value]) => value && regexp.test(key.toUpperCase()))\n .map(([char ,value]) => (char + value).toUpperCase());\n\n return [...lowerCase, ...upperCase].join('');\n }\n\n public replace(text: string): string {\n return text.replace(/./g, (char: string) => this[char]);\n }\n\n /**\n * Check if the given string is uppercase\n *\n * @param {string} [text=''] string to check\n * @returns {boolean} true if text is uppercase\n * @memberof DiacriticMapperCore\n */\n public isUpperCase(text: string = ''): boolean {\n return text.toUpperCase() === text;\n }\n\n /**\n * Check if the given string is lowercase\n *\n * @param {string} [text=''] string to check\n * @returns {boolean} true if text is lowercase\n * @memberof DiacriticMapperCore\n */\n public isLowerCase(text: string = ''): boolean {\n return text.toLowerCase() === text;\n }\n}\n\nexport default DiacriticMapperCore;","/**\n * i18n jsons and i18n-all.ts use material from Wikipedia\n * Article: https://en.wikipedia.org/wiki/Diacritic\n * License: CC-BY-SA 3.0\n */\nexport default {\n \"a\": \"áäâàåÄąāãă\",\n \"e\": \"éèêëěÊęėēё\",\n \"i\": \"íîïi̇řìįī\",\n \"o\": \"óôöòøōõơ\",\n \"u\": \"úûüùůŭųūư\",\n \"y\": \"ýÿŷỳ\",\n \"n\": \"ñňŋņń\",\n \"l\": \"ḷŀłļĺľ\",\n \"h\": \"ḥĥȟħ\",\n \"c\": \"çčćĉĊ\",\n \"g\": \"ğĝǧģĠġ\",\n \"s\": \"şšŝṣșſś\",\n \"у\": \"ў\",\n \"и\": \"йѝ\",\n \"е\": \"ё\",\n \"d\": \"đďðḏ\",\n \"z\": \"žŻźż\",\n \"t\": \"ťțțṭ\",\n \"w\": \"ẅŵẃẁ\",\n \"ae\": \"æ\",\n \"ss\": \"ß\",\n \"α\": \"ά\",\n \"ε\": \"έ\",\n \"η\": \"ή\",\n \"ι\": \"ίΐϊ\",\n \"ο\": \"ό\",\n \"υ\": \"ύΰϋ\",\n \"ω\": \"ώ\",\n \"j\": \"ĵ\",\n \"oe\": \"œ\",\n \"\": \"ʰ'ʼ·׳\",\n \"ii\": \"î\",\n \"k\": \"ķ\",\n \"к\": \"ќ\",\n \"г\": \"ѓґ\",\n \"ij\": \"ij\",\n \"r\": \"ŕ\",\n \"і\": \"ї\"\n};","import DiacriticRemoverHandler from './diacritic-remover-handler.class';\nimport DiacriticSetInterface from '../interfaces/diacritic-set.interface';\nimport DiacriticMapperCore from './diacritic-mapper-core.class';\n\nimport I18N_ALL from '../i18n/i18n-all.const';\n\nclass DiacriticRemover extends DiacriticMapperCore {\n [letter: string]: string|any;\n constructor(...dictionaries: DiacriticSetInterface[]) {\n super(dictionaries.length ? dictionaries : [I18N_ALL as DiacriticSetInterface]);\n Object.defineProperty(this, 'dictionary', {\n enumerable: false,\n configurable: false\n });\n return new Proxy(this, new DiacriticRemoverHandler());\n }\n}\nexport default DiacriticRemover;"],"names":["isString","arg","DiacriticAbstractHandler","[object Object]","target","prop","receiver","length","this","diacriticTrap","Reflect","get","char","DiacriticRemoverHandler","super","upperCase","isUpperCase","lowerCaseChar","toLowerCase","plainChar","Object","entries","dictionary","find","diacritics","includes","toUpperCase","DiacriticMatcherHandler","matcher","DiacriticInsensitiveMatcherHandler","insensitiveMatcher","Set","forEach","diacritic","add","sort","join","DiacriticValidatorHandler","matchingDiacritics","RegExp","DiacriticInsensitiveValidatorHandler","DiacriticMapperCore","dictionaries","reduce","dictMerge","currentDict","accumulator","letter","freeze","Proxy","validator","insensitiveValidator","regexp","filter","key","value","test","map","text","replace","a","e","i","o","u","y","n","l","h","c","g","s","у","и","е","d","z","t","w","ae","ss","α","ε","η","ι","ο","υ","ω","j","oe","ii","k","к","г","ij","r","і","DiacriticRemover","I18N_ALL","defineProperty","enumerable","configurable"],"mappings":";;;;;;;;;aAmdO,SAASA,SAASC,GACvB,MAAsB,iBAARA,ECjdhB,MAAeC,yBACXC,IAAIC,EAAkCC,EAAmBC,GACrD,OAAIN,SAASK,IAASA,EAAKE,QAAU,EAC1BC,KAAKC,cAAcL,EAAQC,GAE/BK,QAAQC,IAAIP,EAAQC,EAAMC,GAG3BH,cAAcC,EAAkCQ,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AAK,QACLC,EAAK,SACLC,EAAK,UACLC,IAAK,IACLC,IAAK,KACLC,IAAK,IACLC,EAAK,OACLC,EAAK,OACLC,EAAK,OACLC,EAAK,OACLC,GAAM,IACNC,GAAM,IACNC,IAAK,IACLC,IAAK,IACLC,IAAK,IACLC,IAAK,MACLC,IAAK,IACLC,IAAK,MACLC,IAAK,IACLC,EAAK,IACLC,GAAM,IACN,GAAI,QACJC,GAAM,IACNC,EAAK,IACLC,IAAK,IACLC,IAAK,KACLC,GAAM,IACNC,EAAK,IACLC,IAAK,KCrCT,MAAMC,yBAAyBxD,oBAE3BtC,eAAeuC,GAMX,OALA5B,MAAM4B,EAAanC,OAASmC,EAAe,CAACwD,WAC5C9E,OAAO+E,eAAe3F,KAAM,aAAc,CACtC4F,YAAY,EACZC,cAAc,IAEX,IAAIpD,MAAMzC,KAAM,IAAIK"} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 8a0cbb2..064ef2f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@marketto/diacritic-remover", - "version": "1.0.2", + "version": "1.0.3", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 03c0ea9..bd3089c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@marketto/diacritic-remover", - "version": "1.0.2", + "version": "1.0.3", "description": "Tool to replace diacritics in strings", "main": "dist/diacritic-remover.js", "module": "dist/diacritic-remover.es.js", @@ -43,6 +43,7 @@ "typescript": "^3.7.2" }, "scripts": { + "release": "npm audit fix && npm run lint-fix && npm run test && npm run build", "build": "node ./scripts/i18n-all.js && npx rollup -c", "lint": "npx tslint -c tslint.json \"src/**/*.ts\"", "lint-fix": "npx tslint -c tslint.json \"src/**/*.ts\" --fix", diff --git a/rollup.config.js b/rollup.config.js index b726c5c..b3120df 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -1,10 +1,12 @@ import rollupPluginTs from "@wessberg/rollup-plugin-ts"; import pkg from './package.json'; +import tsconfig from './tsconfig.json'; import { terser } from 'rollup-plugin-terser'; import builtins from 'rollup-plugin-node-builtins'; import license from 'rollup-plugin-license'; import path from 'path'; + const baseConf = { input: 'src/diacritic-remover.ts', external: [ @@ -59,6 +61,7 @@ export default [ plugins: [ rollupPluginTs({ tsconfig: { + ...tsconfig.compilerOptions, declaration: false } }), diff --git a/sonar-project.properties b/sonar-project.properties index 21abf37..f4a639e 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -1,4 +1,4 @@ -sonar.projectVersion=1.0.2 +sonar.projectVersion=1.0.3 sonar.sourceEncoding=UTF-8 sonar.sources=./src sonar.projectName=diacritic-remover diff --git a/src/classes/diacritic-abstract-handler.class.ts b/src/classes/diacritic-abstract-handler.class.ts index 919efba..375ade9 100644 --- a/src/classes/diacritic-abstract-handler.class.ts +++ b/src/classes/diacritic-abstract-handler.class.ts @@ -3,18 +3,14 @@ import DiacriticMapperInterface from '../interfaces/diacritic-mapper.interface'; abstract class DiacriticAbstractHandler implements ProxyHandler { get(target: DiacriticMapperInterface, prop: PropertyKey, receiver: any): any { - if (isString(prop) && prop.length === 1) { + if (isString(prop) && prop.length <= 1) { return this.diacriticTrap(target, prop); } return Reflect.get(target, prop, receiver); } - has(target: DiacriticMapperInterface, prop: PropertyKey): boolean { - return (isString(prop) && prop.length === 1) || Reflect.has(target, prop); - } - protected diacriticTrap(target: DiacriticMapperInterface, char: string): any { - return; + return char; } } diff --git a/src/classes/diacritic-insensitive-matcher-handler.class.ts b/src/classes/diacritic-insensitive-matcher-handler.class.ts index 86326cb..6dd577e 100644 --- a/src/classes/diacritic-insensitive-matcher-handler.class.ts +++ b/src/classes/diacritic-insensitive-matcher-handler.class.ts @@ -3,11 +3,16 @@ import DiacriticMapperInterface from '../interfaces/diacritic-mapper.interface'; class DiacriticInsensitiveMatcherHandler extends DiacriticAbstractHandler { protected diacriticTrap(target: DiacriticMapperInterface, char: string): string { - super.diacriticTrap(target, char); - const diacritics = target.dictionary[char.toLowerCase()]; - return diacritics ? ( - diacritics + diacritics.toUpperCase() - ) : char; + const lowerCaseChar = super.diacriticTrap(target, char).toLowerCase(); + const insensitiveMatcher = new Set([lowerCaseChar, lowerCaseChar.toUpperCase()]); + const diacritics = target.dictionary[lowerCaseChar] || ''; + [...diacritics] + .forEach(diacritic => { + insensitiveMatcher.add(diacritic); + insensitiveMatcher.add(diacritic.toUpperCase()); + }); + + return [...insensitiveMatcher].sort().join(''); } } diff --git a/src/classes/diacritic-mapper-core.class.ts b/src/classes/diacritic-mapper-core.class.ts index 020635c..95039dd 100644 --- a/src/classes/diacritic-mapper-core.class.ts +++ b/src/classes/diacritic-mapper-core.class.ts @@ -21,19 +21,21 @@ class DiacriticMapperCore implements DiacriticMapperInterface { public insensitiveValidator: DiacriticValidatorSetInterface; public constructor(dictionaries: DiacriticSetInterface[]) { - const dictionary = dictionaries.reduce((accumulator: DiacriticSetInterface, currentDict: DiacriticSetInterface) => { - Object.entries(currentDict).forEach(([letter, diacritics]) => { - if (isString(diacritics)){ - if (letter in accumulator) { - const newDiacritics = diacritics.split('').filter(l => !accumulator[letter].includes(l)).join(''); - accumulator[letter] += newDiacritics; - } else { - accumulator[letter] = diacritics; - } - } + const dictionary = dictionaries + .reduce(( + dictMerge: DiacriticSetInterface, + currentDict: DiacriticSetInterface + ) => Object.entries(currentDict) + .reduce((accumulator: DiacriticSetInterface, [letter, diacritics]) => ({ + ...accumulator, + [letter]: (accumulator[letter] || '') + diacritics + }), dictMerge), + {}); + + Object.entries(dictionary) + .forEach(([letter, diacritics]) => { + dictionary[letter] = [...(new Set([...diacritics]))].sort().join(''); }); - return accumulator; - }, {}); this.dictionary = Object.freeze(dictionary); this.matcher = new Proxy(this, new DiacriticMatcherHandler()); @@ -45,11 +47,11 @@ class DiacriticMapperCore implements DiacriticMapperInterface { public matcherBy(regexp: RegExp): string { const lowerCase = Object.entries(this.dictionary) .filter(([key, value]) => value && regexp.test(key)) - .map(([,value]) => value); + .map(([char ,value]) => char + value); const upperCase = Object.entries(this.dictionary) .filter(([key, value]) => value && regexp.test(key.toUpperCase())) - .map(([,value]) => value.toUpperCase()); + .map(([char ,value]) => (char + value).toUpperCase()); return [...lowerCase, ...upperCase].join(''); } diff --git a/src/classes/diacritic-matcher-handler.class.ts b/src/classes/diacritic-matcher-handler.class.ts index 9c6900f..4b81849 100644 --- a/src/classes/diacritic-matcher-handler.class.ts +++ b/src/classes/diacritic-matcher-handler.class.ts @@ -3,12 +3,13 @@ import DiacriticMapperInterface from '../interfaces/diacritic-mapper.interface'; class DiacriticMatcherHandler extends DiacriticAbstractHandler { protected diacriticTrap(target: DiacriticMapperInterface, char: string): string { - super.diacriticTrap(target, char); + let matcher = super.diacriticTrap(target, char); + const diacritics = target.dictionary[char.toLowerCase()]; if (diacritics) { - return target.isUpperCase(char) ? diacritics.toUpperCase() : diacritics; + matcher+= target.isUpperCase(matcher) ? diacritics.toUpperCase() : diacritics; } - return char; + return matcher; } } diff --git a/src/classes/diacritic-remover-handler.class.ts b/src/classes/diacritic-remover-handler.class.ts index cb2757e..9d1375a 100644 --- a/src/classes/diacritic-remover-handler.class.ts +++ b/src/classes/diacritic-remover-handler.class.ts @@ -8,12 +8,12 @@ class DiacriticRemoverHandler extends DiacriticAbstractHandler { const upperCase: boolean = target.isUpperCase(char); const lowerCaseChar = char.toLowerCase(); - const plainChar = Object.keys(target.dictionary) - .find(c => isString(target.dictionary[c]) && target.dictionary[c].includes(lowerCaseChar)); + const [plainChar] = Object.entries(target.dictionary) + .find(([, diacritics]) => isString(diacritics) && diacritics.includes(lowerCaseChar)) || []; if (upperCase && plainChar) { return plainChar.toUpperCase(); } - return plainChar || char; + return isString(plainChar) ? plainChar : char; } } diff --git a/src/classes/diacritic-remover.class.ts b/src/classes/diacritic-remover.class.ts index 86c2c02..711f5f7 100644 --- a/src/classes/diacritic-remover.class.ts +++ b/src/classes/diacritic-remover.class.ts @@ -4,7 +4,7 @@ import DiacriticMapperCore from './diacritic-mapper-core.class'; import I18N_ALL from '../i18n/i18n-all.const'; -class DiacriticRemover extends DiacriticMapperCore{ +class DiacriticRemover extends DiacriticMapperCore { [letter: string]: string|any; constructor(...dictionaries: DiacriticSetInterface[]) { super(dictionaries.length ? dictionaries : [I18N_ALL as DiacriticSetInterface]); diff --git a/test/diacritics.test.ts b/test/diacritics.test.ts index 9eda3e0..3eaf66e 100644 --- a/test/diacritics.test.ts +++ b/test/diacritics.test.ts @@ -4,18 +4,28 @@ import DiacriticRemover from '../src/diacritic-remover'; const diacriticRemover = new DiacriticRemover(); describe('Diacritic Remover Handler', () => { - it ('Should remove deacritic', () => { + it ('Should return a for à', () => { expect(diacriticRemover.à).to.be.equal('a'); }); it ('Should return char for missing diacritics', () => { expect(diacriticRemover['3']).to.be.equal('3'); }); + it('Should return empty string for \'', () => { + expect(diacriticRemover['\'']).to.be.equal(''); + }); }); describe('Diacritic Matcher', () => { - it ('Should find deacritics', () => { - expect(diacriticRemover.matcher.i).not.to.be.undefined; + it ('Should return i diacritics for i, including i itself', () => { expect(diacriticRemover.matcher.i).to.include('ì'); + expect(diacriticRemover.matcher.i).to.include('i'); + }); + it('Should include m and c', () => { + expect(diacriticRemover.matcher.m).to.include('m'); + expect(diacriticRemover.matcher.c).to.include('c'); + }); + it('Should return \'·ʰʼ׳ for empty string', () => { + expect(diacriticRemover.matcher['']).to.be.equal('\'·ʰʼ׳'); }); }); @@ -25,7 +35,15 @@ describe('Diacritic Insensitive Matcher', () => { const matcherO = diacriticRemover.matcher.O; expect(matchero).not.to.be.undefined; expect(matcherO).not.to.be.undefined; - expect(diacriticRemover.insensitiveMatcher.o).to.be.equal(matchero + matcherO); + expect(diacriticRemover.insensitiveMatcher.o) + .to.equal([...matchero, ...matcherO].sort().join('')); + }); + it('Should include char', () => { + expect(diacriticRemover.insensitiveMatcher.m).to.include('m'); + expect(diacriticRemover.insensitiveMatcher.c).to.include('c'); + }); + it('Should return \'\'·ʰʼ׳\' for empty string', () => { + expect(diacriticRemover.insensitiveMatcher['']).to.be.equal('\'·ʰʼ׳'); }); }); diff --git a/test/i18n.test.ts b/test/i18n.test.ts index 16e2aed..f44a3f1 100644 --- a/test/i18n.test.ts +++ b/test/i18n.test.ts @@ -24,6 +24,6 @@ describe('Multiple dictionaries', () => { expect(diacriticRemover.ý).to.be.equal('y'); }); it('Should not duplicate diacritics in merged dictionary', () => { - expect(diacriticRemover.matcher.e).to.be.equal("èéê"); + expect(diacriticRemover.matcher.e).to.be.equal("eèéê"); }); }); \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 4125113..df1d938 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,64 +1,13 @@ { "compilerOptions": { - /* Basic Options */ - // "incremental": true, /* Enable incremental compilation */ - "target": "ES2015", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - // "lib": [], /* Specify library files to be included in the compilation. */ - // "allowJs": true, /* Allow javascript files to be compiled. */ - // "checkJs": true, /* Report errors in .js files. */ - // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ - "declaration": true, /* Generates corresponding '.d.ts' file. */ - //"declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ - // "sourceMap": true, /* Generates corresponding '.map' file. */ - // "outFile": "./dist/test", /* Concatenate and emit output to single file. */ - // "outDir": "./", /* Redirect output structure to the directory. */ - // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ - // "composite": true, /* Enable project compilation */ - // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ - // "removeComments": true, /* Do not emit comments to output. */ - // "noEmit": true, /* Do not emit outputs. */ - // "importHelpers": true, /* Import emit helpers from 'tslib'. */ - // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ - // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ - - /* Strict Type-Checking Options */ - "strict": true, /* Enable all strict type-checking options. */ - // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ - // "strictNullChecks": true, /* Enable strict null checks. */ - // "strictFunctionTypes": true, /* Enable strict checking of function types. */ - // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ - // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ - // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ - // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ - - /* Additional Checks */ - // "noUnusedLocals": true, /* Report errors on unused locals. */ - // "noUnusedParameters": true, /* Report errors on unused parameters. */ - // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ - // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ - - /* Module Resolution Options */ - "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ - // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ - // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ - // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ - // "typeRoots": [], /* List of folders to include type definitions from. */ - // "types": [], /* Type declaration files to be included in compilation. */ - // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ - "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ - // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ - - /* Source Map Options */ - // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ - // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ - // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ - // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ - - /* Experimental Options */ - // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ - // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ + "target": "ES2015", + "module": "commonjs", + "declaration": true, + "downlevelIteration": true, + "strict": true, + "noImplicitAny": true, + "moduleResolution": "node", + "esModuleInterop": true, "resolveJsonModule": true }, "typeRoots": [