@stryke/string-format 0.13.2 → 0.13.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/dist/acronyms.cjs +411 -1
- package/dist/acronyms.mjs +407 -1
- package/dist/acronyms.mjs.map +1 -1
- package/dist/articles.cjs +10 -1
- package/dist/articles.mjs +9 -1
- package/dist/articles.mjs.map +1 -1
- package/dist/camel-case.cjs +32 -1
- package/dist/camel-case.mjs +31 -1
- package/dist/camel-case.mjs.map +1 -1
- package/dist/combine.cjs +15 -1
- package/dist/combine.mjs +14 -1
- package/dist/combine.mjs.map +1 -1
- package/dist/conjunctions.cjs +32 -1
- package/dist/conjunctions.mjs +31 -1
- package/dist/conjunctions.mjs.map +1 -1
- package/dist/constant-case.cjs +32 -1
- package/dist/constant-case.mjs +31 -1
- package/dist/constant-case.mjs.map +1 -1
- package/dist/deburr.cjs +28 -1
- package/dist/deburr.mjs +28 -1
- package/dist/deburr.mjs.map +1 -1
- package/dist/decamelize.cjs +14 -1
- package/dist/decamelize.mjs +13 -1
- package/dist/decamelize.mjs.map +1 -1
- package/dist/escape.cjs +49 -1
- package/dist/escape.mjs +47 -1
- package/dist/escape.mjs.map +1 -1
- package/dist/format-special-cases.cjs +33 -1
- package/dist/format-special-cases.mjs +33 -1
- package/dist/format-special-cases.mjs.map +1 -1
- package/dist/get-words.cjs +40 -1
- package/dist/get-words.mjs +37 -1
- package/dist/get-words.mjs.map +1 -1
- package/dist/helpers/src/remove-accents.cjs +415 -1
- package/dist/helpers/src/remove-accents.mjs +414 -1
- package/dist/helpers/src/remove-accents.mjs.map +1 -1
- package/dist/index.cjs +75 -1
- package/dist/index.mjs +30 -1
- package/dist/kebab-case.cjs +34 -1
- package/dist/kebab-case.mjs +33 -1
- package/dist/kebab-case.mjs.map +1 -1
- package/dist/lower-case-first.cjs +17 -1
- package/dist/lower-case-first.mjs +16 -1
- package/dist/lower-case-first.mjs.map +1 -1
- package/dist/normalize-email.cjs +31 -1
- package/dist/normalize-email.mjs +30 -1
- package/dist/normalize-email.mjs.map +1 -1
- package/dist/package.cjs +124 -1
- package/dist/package.mjs +120 -1
- package/dist/package.mjs.map +1 -1
- package/dist/pad.cjs +25 -1
- package/dist/pad.mjs +24 -1
- package/dist/pad.mjs.map +1 -1
- package/dist/pascal-case.cjs +32 -1
- package/dist/pascal-case.mjs +31 -1
- package/dist/pascal-case.mjs.map +1 -1
- package/dist/period-split.cjs +38 -1
- package/dist/period-split.mjs +37 -1
- package/dist/period-split.mjs.map +1 -1
- package/dist/prepositions.cjs +68 -1
- package/dist/prepositions.mjs +67 -1
- package/dist/prepositions.mjs.map +1 -1
- package/dist/pretty-bytes.cjs +129 -1
- package/dist/pretty-bytes.mjs +127 -1
- package/dist/pretty-bytes.mjs.map +1 -1
- package/dist/snake-case.cjs +42 -1
- package/dist/snake-case.mjs +41 -1
- package/dist/snake-case.mjs.map +1 -1
- package/dist/special-cases.cjs +53 -1
- package/dist/special-cases.mjs +52 -1
- package/dist/special-cases.mjs.map +1 -1
- package/dist/start-case.cjs +46 -1
- package/dist/start-case.mjs +45 -1
- package/dist/start-case.mjs.map +1 -1
- package/dist/strip-indents.cjs +24 -3
- package/dist/strip-indents.mjs +23 -3
- package/dist/strip-indents.mjs.map +1 -1
- package/dist/title-case.cjs +19 -1
- package/dist/title-case.mjs +19 -1
- package/dist/title-case.mjs.map +1 -1
- package/dist/types/src/base.cjs +6 -1
- package/dist/types/src/base.mjs +5 -1
- package/dist/types/src/base.mjs.map +1 -1
- package/dist/unescape.cjs +30 -1
- package/dist/unescape.mjs +29 -1
- package/dist/unescape.mjs.map +1 -1
- package/dist/upper-case-first.cjs +17 -1
- package/dist/upper-case-first.mjs +16 -1
- package/dist/upper-case-first.mjs.map +1 -1
- package/dist/vowels.cjs +40 -1
- package/dist/vowels.mjs +38 -1
- package/dist/vowels.mjs.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-special-cases.mjs","names":[],"sources":["../src/format-special-cases.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { ACRONYMS } from \"./acronyms\";\nimport { ARTICLES } from \"./articles\";\nimport { CONJUNCTIONS } from \"./conjunctions\";\nimport { PREPOSITIONS } from \"./prepositions\";\nimport { SPECIAL_CASES } from \"./special-cases\";\n\nexport interface FormatSpecialCasesOptions {\n /**\n * If true, use the descriptions from the acronym list instead of the display names.\n *\n * @defaultValue true\n */\n useDescriptions?: boolean;\n}\n\n/**\n * Handle special words in a title.\n *\n * @see https://apastyle.apa.org/style-grammar-guidelines/capitalization/title-case\n *\n * @param value - The word to handle\n * @param index - The index of the word in the title\n * @param words - The full title as an array of words\n * @returns The formatted word\n */\nexport function formatSpecialCases(\n value: string,\n index: number,\n words: string[],\n options?: FormatSpecialCasesOptions\n): string {\n const lowercaseStr = value.toLowerCase();\n const uppercaseStr = value.toUpperCase();\n\n for (const special of SPECIAL_CASES) {\n if (special.toLowerCase() === lowercaseStr) {\n return special;\n }\n }\n\n if (ACRONYMS[uppercaseStr]) {\n return options?.useDescriptions !== false\n ? ACRONYMS[uppercaseStr].description\n : ACRONYMS[uppercaseStr].display || uppercaseStr;\n }\n\n // If the word is the first word in the sentence, but it's not a specially\n // cased word or an acronym, return the capitalized string\n if (index === 0) {\n return value;\n }\n\n // If the word is the last word in the sentence, but it's not a specially\n // cased word or an acronym, return the capitalized string\n if (index === words.length - 1) {\n return value;\n }\n\n // Return the word capitalized if it's 4 characters or more\n if (value.length >= 4) {\n return value;\n }\n\n if (PREPOSITIONS.includes(lowercaseStr)) {\n return lowercaseStr;\n }\n if (CONJUNCTIONS.includes(lowercaseStr)) {\n return lowercaseStr;\n }\n if (ARTICLES.includes(lowercaseStr)) {\n return lowercaseStr;\n }\n\n return value;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"format-special-cases.mjs","names":[],"sources":["../src/format-special-cases.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { ACRONYMS } from \"./acronyms\";\nimport { ARTICLES } from \"./articles\";\nimport { CONJUNCTIONS } from \"./conjunctions\";\nimport { PREPOSITIONS } from \"./prepositions\";\nimport { SPECIAL_CASES } from \"./special-cases\";\n\nexport interface FormatSpecialCasesOptions {\n /**\n * If true, use the descriptions from the acronym list instead of the display names.\n *\n * @defaultValue true\n */\n useDescriptions?: boolean;\n}\n\n/**\n * Handle special words in a title.\n *\n * @see https://apastyle.apa.org/style-grammar-guidelines/capitalization/title-case\n *\n * @param value - The word to handle\n * @param index - The index of the word in the title\n * @param words - The full title as an array of words\n * @returns The formatted word\n */\nexport function formatSpecialCases(\n value: string,\n index: number,\n words: string[],\n options?: FormatSpecialCasesOptions\n): string {\n const lowercaseStr = value.toLowerCase();\n const uppercaseStr = value.toUpperCase();\n\n for (const special of SPECIAL_CASES) {\n if (special.toLowerCase() === lowercaseStr) {\n return special;\n }\n }\n\n if (ACRONYMS[uppercaseStr]) {\n return options?.useDescriptions !== false\n ? ACRONYMS[uppercaseStr].description\n : ACRONYMS[uppercaseStr].display || uppercaseStr;\n }\n\n // If the word is the first word in the sentence, but it's not a specially\n // cased word or an acronym, return the capitalized string\n if (index === 0) {\n return value;\n }\n\n // If the word is the last word in the sentence, but it's not a specially\n // cased word or an acronym, return the capitalized string\n if (index === words.length - 1) {\n return value;\n }\n\n // Return the word capitalized if it's 4 characters or more\n if (value.length >= 4) {\n return value;\n }\n\n if (PREPOSITIONS.includes(lowercaseStr)) {\n return lowercaseStr;\n }\n if (CONJUNCTIONS.includes(lowercaseStr)) {\n return lowercaseStr;\n }\n if (ARTICLES.includes(lowercaseStr)) {\n return lowercaseStr;\n }\n\n return value;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AA2CA,SAAgB,mBACd,OACA,OACA,OACA,SACQ;CACR,MAAM,eAAe,MAAM,aAAa;CACxC,MAAM,eAAe,MAAM,aAAa;AAExC,MAAK,MAAM,WAAW,cACpB,KAAI,QAAQ,aAAa,KAAK,aAC5B,QAAO;AAIX,KAAI,SAAS,cACX,QAAO,SAAS,oBAAoB,QAChC,SAAS,cAAc,cACvB,SAAS,cAAc,WAAW;AAKxC,KAAI,UAAU,EACZ,QAAO;AAKT,KAAI,UAAU,MAAM,SAAS,EAC3B,QAAO;AAIT,KAAI,MAAM,UAAU,EAClB,QAAO;AAGT,KAAI,aAAa,SAAS,aAAa,CACrC,QAAO;AAET,KAAI,aAAa,SAAS,aAAa,CACrC,QAAO;AAET,KAAI,SAAS,SAAS,aAAa,CACjC,QAAO;AAGT,QAAO"}
|
package/dist/get-words.cjs
CHANGED
|
@@ -1 +1,40 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
//#region src/get-words.ts
|
|
3
|
+
/**
|
|
4
|
+
* Regular expression pattern to split strings into words for various case conversions
|
|
5
|
+
*
|
|
6
|
+
* This pattern matches sequences of characters in a string, considering the following case:
|
|
7
|
+
* - Sequences of two or more uppercase letters followed by an uppercase letter and lowercase letters or digits (for acronyms)
|
|
8
|
+
* - Sequences of one uppercase letter optionally followed by lowercase letters and digits
|
|
9
|
+
* - Single uppercase letters
|
|
10
|
+
* - Sequences of digits
|
|
11
|
+
*
|
|
12
|
+
* The resulting match can be used to convert camelCase, snake_case, kebab-case, and other mixed formats into
|
|
13
|
+
* a consistent format like snake case.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* const matches = 'camelCaseHTTPRequest'.match(CASE_SPLIT_PATTERN);
|
|
17
|
+
* // matches: ['camel', 'Case', 'HTTP', 'Request']
|
|
18
|
+
*/
|
|
19
|
+
const CASE_SPLIT_PATTERN = /[A-Z]?[a-z]+|\d+|[A-Z]+(?![a-z])/g;
|
|
20
|
+
const RELAXED_SPLIT_PATTERN = /[A-Z/.-]?[a-z/.-]+|\d+|[A-Z/.-]+(?![a-z/.-])/g;
|
|
21
|
+
/**
|
|
22
|
+
* Splits a string into words using a regular expression pattern
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* const words = getWords('camelCaseHTTPRequest');
|
|
26
|
+
* // words: ['camel', 'Case', 'HTTP', 'Request']
|
|
27
|
+
*
|
|
28
|
+
* @param str - The string to split into words
|
|
29
|
+
* @param options - Options for splitting the string
|
|
30
|
+
* @returns An array of words
|
|
31
|
+
*/
|
|
32
|
+
function getWords(str, options = {}) {
|
|
33
|
+
if (str.length > 5e3) throw new Error("The regular expression parameter of `get-words` can't handle strings longer than 2000 characters");
|
|
34
|
+
return [...str.match(options.split ?? (options.relaxed ? RELAXED_SPLIT_PATTERN : CASE_SPLIT_PATTERN)) ?? []];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
//#endregion
|
|
38
|
+
exports.CASE_SPLIT_PATTERN = CASE_SPLIT_PATTERN;
|
|
39
|
+
exports.RELAXED_SPLIT_PATTERN = RELAXED_SPLIT_PATTERN;
|
|
40
|
+
exports.getWords = getWords;
|
package/dist/get-words.mjs
CHANGED
|
@@ -1,2 +1,38 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/get-words.ts
|
|
2
|
+
/**
|
|
3
|
+
* Regular expression pattern to split strings into words for various case conversions
|
|
4
|
+
*
|
|
5
|
+
* This pattern matches sequences of characters in a string, considering the following case:
|
|
6
|
+
* - Sequences of two or more uppercase letters followed by an uppercase letter and lowercase letters or digits (for acronyms)
|
|
7
|
+
* - Sequences of one uppercase letter optionally followed by lowercase letters and digits
|
|
8
|
+
* - Single uppercase letters
|
|
9
|
+
* - Sequences of digits
|
|
10
|
+
*
|
|
11
|
+
* The resulting match can be used to convert camelCase, snake_case, kebab-case, and other mixed formats into
|
|
12
|
+
* a consistent format like snake case.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* const matches = 'camelCaseHTTPRequest'.match(CASE_SPLIT_PATTERN);
|
|
16
|
+
* // matches: ['camel', 'Case', 'HTTP', 'Request']
|
|
17
|
+
*/
|
|
18
|
+
const CASE_SPLIT_PATTERN = /[A-Z]?[a-z]+|\d+|[A-Z]+(?![a-z])/g;
|
|
19
|
+
const RELAXED_SPLIT_PATTERN = /[A-Z/.-]?[a-z/.-]+|\d+|[A-Z/.-]+(?![a-z/.-])/g;
|
|
20
|
+
/**
|
|
21
|
+
* Splits a string into words using a regular expression pattern
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* const words = getWords('camelCaseHTTPRequest');
|
|
25
|
+
* // words: ['camel', 'Case', 'HTTP', 'Request']
|
|
26
|
+
*
|
|
27
|
+
* @param str - The string to split into words
|
|
28
|
+
* @param options - Options for splitting the string
|
|
29
|
+
* @returns An array of words
|
|
30
|
+
*/
|
|
31
|
+
function getWords(str, options = {}) {
|
|
32
|
+
if (str.length > 5e3) throw new Error("The regular expression parameter of `get-words` can't handle strings longer than 2000 characters");
|
|
33
|
+
return [...str.match(options.split ?? (options.relaxed ? RELAXED_SPLIT_PATTERN : CASE_SPLIT_PATTERN)) ?? []];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
//#endregion
|
|
37
|
+
export { CASE_SPLIT_PATTERN, RELAXED_SPLIT_PATTERN, getWords };
|
|
2
38
|
//# sourceMappingURL=get-words.mjs.map
|
package/dist/get-words.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-words.mjs","names":[],"sources":["../src/get-words.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\n/**\n * Regular expression pattern to split strings into words for various case conversions\n *\n * This pattern matches sequences of characters in a string, considering the following case:\n * - Sequences of two or more uppercase letters followed by an uppercase letter and lowercase letters or digits (for acronyms)\n * - Sequences of one uppercase letter optionally followed by lowercase letters and digits\n * - Single uppercase letters\n * - Sequences of digits\n *\n * The resulting match can be used to convert camelCase, snake_case, kebab-case, and other mixed formats into\n * a consistent format like snake case.\n *\n * @example\n * const matches = 'camelCaseHTTPRequest'.match(CASE_SPLIT_PATTERN);\n * // matches: ['camel', 'Case', 'HTTP', 'Request']\n */\nexport const CASE_SPLIT_PATTERN = /[A-Z]?[a-z]+|\\d+|[A-Z]+(?![a-z])/g;\n\nexport const RELAXED_SPLIT_PATTERN =\n /[A-Z/.-]?[a-z/.-]+|\\d+|[A-Z/.-]+(?![a-z/.-])/g;\n\n/**\n * Options for splitting a string into words\n */\nexport interface GetWordsOptions {\n /**\n * Whether to use a relaxed splitting pattern\n */\n relaxed?: boolean;\n\n /**\n * Custom regular expression for splitting the string\n */\n split?: RegExp;\n}\n\n/**\n * Splits a string into words using a regular expression pattern\n *\n * @example\n * const words = getWords('camelCaseHTTPRequest');\n * // words: ['camel', 'Case', 'HTTP', 'Request']\n *\n * @param str - The string to split into words\n * @param options - Options for splitting the string\n * @returns An array of words\n */\nexport function getWords(str: string, options: GetWordsOptions = {}): string[] {\n if (str.length > 5000) {\n throw new Error(\n \"The regular expression parameter of `get-words` can't handle strings longer than 2000 characters\"\n );\n }\n\n return [\n ...(str.match(\n options.split ??\n (options.relaxed ? RELAXED_SPLIT_PATTERN : CASE_SPLIT_PATTERN)\n ) ?? [])\n ];\n}\n"],"mappings":"AAkCA,MAAa,
|
|
1
|
+
{"version":3,"file":"get-words.mjs","names":[],"sources":["../src/get-words.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\n/**\n * Regular expression pattern to split strings into words for various case conversions\n *\n * This pattern matches sequences of characters in a string, considering the following case:\n * - Sequences of two or more uppercase letters followed by an uppercase letter and lowercase letters or digits (for acronyms)\n * - Sequences of one uppercase letter optionally followed by lowercase letters and digits\n * - Single uppercase letters\n * - Sequences of digits\n *\n * The resulting match can be used to convert camelCase, snake_case, kebab-case, and other mixed formats into\n * a consistent format like snake case.\n *\n * @example\n * const matches = 'camelCaseHTTPRequest'.match(CASE_SPLIT_PATTERN);\n * // matches: ['camel', 'Case', 'HTTP', 'Request']\n */\nexport const CASE_SPLIT_PATTERN = /[A-Z]?[a-z]+|\\d+|[A-Z]+(?![a-z])/g;\n\nexport const RELAXED_SPLIT_PATTERN =\n /[A-Z/.-]?[a-z/.-]+|\\d+|[A-Z/.-]+(?![a-z/.-])/g;\n\n/**\n * Options for splitting a string into words\n */\nexport interface GetWordsOptions {\n /**\n * Whether to use a relaxed splitting pattern\n */\n relaxed?: boolean;\n\n /**\n * Custom regular expression for splitting the string\n */\n split?: RegExp;\n}\n\n/**\n * Splits a string into words using a regular expression pattern\n *\n * @example\n * const words = getWords('camelCaseHTTPRequest');\n * // words: ['camel', 'Case', 'HTTP', 'Request']\n *\n * @param str - The string to split into words\n * @param options - Options for splitting the string\n * @returns An array of words\n */\nexport function getWords(str: string, options: GetWordsOptions = {}): string[] {\n if (str.length > 5000) {\n throw new Error(\n \"The regular expression parameter of `get-words` can't handle strings longer than 2000 characters\"\n );\n }\n\n return [\n ...(str.match(\n options.split ??\n (options.relaxed ? RELAXED_SPLIT_PATTERN : CASE_SPLIT_PATTERN)\n ) ?? [])\n ];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAkCA,MAAa,qBAAqB;AAElC,MAAa,wBACX;;;;;;;;;;;;AA4BF,SAAgB,SAAS,KAAa,UAA2B,EAAE,EAAY;AAC7E,KAAI,IAAI,SAAS,IACf,OAAM,IAAI,MACR,mGACD;AAGH,QAAO,CACL,GAAI,IAAI,MACN,QAAQ,UACL,QAAQ,UAAU,wBAAwB,oBAC9C,IAAI,EAAE,CACR"}
|
|
@@ -1 +1,415 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
//#region ../helpers/src/remove-accents.ts
|
|
3
|
+
const characterMap = {
|
|
4
|
+
À: "A",
|
|
5
|
+
Á: "A",
|
|
6
|
+
Â: "A",
|
|
7
|
+
Ã: "A",
|
|
8
|
+
Ä: "A",
|
|
9
|
+
Å: "A",
|
|
10
|
+
Ấ: "A",
|
|
11
|
+
Ắ: "A",
|
|
12
|
+
Ẳ: "A",
|
|
13
|
+
Ẵ: "A",
|
|
14
|
+
Ặ: "A",
|
|
15
|
+
Æ: "AE",
|
|
16
|
+
Ầ: "A",
|
|
17
|
+
Ằ: "A",
|
|
18
|
+
Ȃ: "A",
|
|
19
|
+
Ç: "C",
|
|
20
|
+
Ḉ: "C",
|
|
21
|
+
È: "E",
|
|
22
|
+
É: "E",
|
|
23
|
+
Ê: "E",
|
|
24
|
+
Ë: "E",
|
|
25
|
+
Ế: "E",
|
|
26
|
+
Ḗ: "E",
|
|
27
|
+
Ề: "E",
|
|
28
|
+
Ḕ: "E",
|
|
29
|
+
Ḝ: "E",
|
|
30
|
+
Ȇ: "E",
|
|
31
|
+
Ì: "I",
|
|
32
|
+
Í: "I",
|
|
33
|
+
Î: "I",
|
|
34
|
+
Ï: "I",
|
|
35
|
+
Ḯ: "I",
|
|
36
|
+
Ȋ: "I",
|
|
37
|
+
Ð: "D",
|
|
38
|
+
Ñ: "N",
|
|
39
|
+
Ò: "O",
|
|
40
|
+
Ó: "O",
|
|
41
|
+
Ô: "O",
|
|
42
|
+
Õ: "O",
|
|
43
|
+
Ö: "O",
|
|
44
|
+
Ø: "O",
|
|
45
|
+
Ố: "O",
|
|
46
|
+
Ṍ: "O",
|
|
47
|
+
Ṓ: "O",
|
|
48
|
+
Ȏ: "O",
|
|
49
|
+
Ù: "U",
|
|
50
|
+
Ú: "U",
|
|
51
|
+
Û: "U",
|
|
52
|
+
Ü: "U",
|
|
53
|
+
Ý: "Y",
|
|
54
|
+
à: "a",
|
|
55
|
+
á: "a",
|
|
56
|
+
â: "a",
|
|
57
|
+
ã: "a",
|
|
58
|
+
ä: "a",
|
|
59
|
+
å: "a",
|
|
60
|
+
ấ: "a",
|
|
61
|
+
ắ: "a",
|
|
62
|
+
ẳ: "a",
|
|
63
|
+
ẵ: "a",
|
|
64
|
+
ặ: "a",
|
|
65
|
+
æ: "ae",
|
|
66
|
+
ầ: "a",
|
|
67
|
+
ằ: "a",
|
|
68
|
+
ȃ: "a",
|
|
69
|
+
ç: "c",
|
|
70
|
+
ḉ: "c",
|
|
71
|
+
è: "e",
|
|
72
|
+
é: "e",
|
|
73
|
+
ê: "e",
|
|
74
|
+
ë: "e",
|
|
75
|
+
ế: "e",
|
|
76
|
+
ḗ: "e",
|
|
77
|
+
ề: "e",
|
|
78
|
+
ḕ: "e",
|
|
79
|
+
ḝ: "e",
|
|
80
|
+
ȇ: "e",
|
|
81
|
+
ì: "i",
|
|
82
|
+
í: "i",
|
|
83
|
+
î: "i",
|
|
84
|
+
ï: "i",
|
|
85
|
+
ḯ: "i",
|
|
86
|
+
ȋ: "i",
|
|
87
|
+
ð: "d",
|
|
88
|
+
ñ: "n",
|
|
89
|
+
ò: "o",
|
|
90
|
+
ó: "o",
|
|
91
|
+
ô: "o",
|
|
92
|
+
õ: "o",
|
|
93
|
+
ö: "o",
|
|
94
|
+
ø: "o",
|
|
95
|
+
ố: "o",
|
|
96
|
+
ṍ: "o",
|
|
97
|
+
ṓ: "o",
|
|
98
|
+
ȏ: "o",
|
|
99
|
+
ù: "u",
|
|
100
|
+
ú: "u",
|
|
101
|
+
û: "u",
|
|
102
|
+
ü: "u",
|
|
103
|
+
ý: "y",
|
|
104
|
+
ÿ: "y",
|
|
105
|
+
Ā: "A",
|
|
106
|
+
ā: "a",
|
|
107
|
+
Ă: "A",
|
|
108
|
+
ă: "a",
|
|
109
|
+
Ą: "A",
|
|
110
|
+
ą: "a",
|
|
111
|
+
Ć: "C",
|
|
112
|
+
ć: "c",
|
|
113
|
+
Ĉ: "C",
|
|
114
|
+
ĉ: "c",
|
|
115
|
+
Ċ: "C",
|
|
116
|
+
ċ: "c",
|
|
117
|
+
Č: "C",
|
|
118
|
+
č: "c",
|
|
119
|
+
C̆: "C",
|
|
120
|
+
c̆: "c",
|
|
121
|
+
Ď: "D",
|
|
122
|
+
ď: "d",
|
|
123
|
+
Đ: "D",
|
|
124
|
+
đ: "d",
|
|
125
|
+
Ē: "E",
|
|
126
|
+
ē: "e",
|
|
127
|
+
Ĕ: "E",
|
|
128
|
+
ĕ: "e",
|
|
129
|
+
Ė: "E",
|
|
130
|
+
ė: "e",
|
|
131
|
+
Ę: "E",
|
|
132
|
+
ę: "e",
|
|
133
|
+
Ě: "E",
|
|
134
|
+
ě: "e",
|
|
135
|
+
Ĝ: "G",
|
|
136
|
+
Ǵ: "G",
|
|
137
|
+
ĝ: "g",
|
|
138
|
+
ǵ: "g",
|
|
139
|
+
Ğ: "G",
|
|
140
|
+
ğ: "g",
|
|
141
|
+
Ġ: "G",
|
|
142
|
+
ġ: "g",
|
|
143
|
+
Ģ: "G",
|
|
144
|
+
ģ: "g",
|
|
145
|
+
Ĥ: "H",
|
|
146
|
+
ĥ: "h",
|
|
147
|
+
Ħ: "H",
|
|
148
|
+
ħ: "h",
|
|
149
|
+
Ḫ: "H",
|
|
150
|
+
ḫ: "h",
|
|
151
|
+
Ĩ: "I",
|
|
152
|
+
ĩ: "i",
|
|
153
|
+
Ī: "I",
|
|
154
|
+
ī: "i",
|
|
155
|
+
Ĭ: "I",
|
|
156
|
+
ĭ: "i",
|
|
157
|
+
Į: "I",
|
|
158
|
+
į: "i",
|
|
159
|
+
İ: "I",
|
|
160
|
+
ı: "i",
|
|
161
|
+
IJ: "IJ",
|
|
162
|
+
ij: "ij",
|
|
163
|
+
Ĵ: "J",
|
|
164
|
+
ĵ: "j",
|
|
165
|
+
Ķ: "K",
|
|
166
|
+
ķ: "k",
|
|
167
|
+
Ḱ: "K",
|
|
168
|
+
ḱ: "k",
|
|
169
|
+
K̆: "K",
|
|
170
|
+
k̆: "k",
|
|
171
|
+
Ĺ: "L",
|
|
172
|
+
ĺ: "l",
|
|
173
|
+
Ļ: "L",
|
|
174
|
+
ļ: "l",
|
|
175
|
+
Ľ: "L",
|
|
176
|
+
ľ: "l",
|
|
177
|
+
Ŀ: "L",
|
|
178
|
+
ŀ: "l",
|
|
179
|
+
Ł: "l",
|
|
180
|
+
ł: "l",
|
|
181
|
+
Ḿ: "M",
|
|
182
|
+
ḿ: "m",
|
|
183
|
+
M̆: "M",
|
|
184
|
+
m̆: "m",
|
|
185
|
+
Ń: "N",
|
|
186
|
+
ń: "n",
|
|
187
|
+
Ņ: "N",
|
|
188
|
+
ņ: "n",
|
|
189
|
+
Ň: "N",
|
|
190
|
+
ň: "n",
|
|
191
|
+
ʼn: "n",
|
|
192
|
+
N̆: "N",
|
|
193
|
+
n̆: "n",
|
|
194
|
+
Ō: "O",
|
|
195
|
+
ō: "o",
|
|
196
|
+
Ŏ: "O",
|
|
197
|
+
ŏ: "o",
|
|
198
|
+
Ő: "O",
|
|
199
|
+
ő: "o",
|
|
200
|
+
Œ: "OE",
|
|
201
|
+
œ: "oe",
|
|
202
|
+
P̆: "P",
|
|
203
|
+
p̆: "p",
|
|
204
|
+
Ŕ: "R",
|
|
205
|
+
ŕ: "r",
|
|
206
|
+
Ŗ: "R",
|
|
207
|
+
ŗ: "r",
|
|
208
|
+
Ř: "R",
|
|
209
|
+
ř: "r",
|
|
210
|
+
R̆: "R",
|
|
211
|
+
r̆: "r",
|
|
212
|
+
Ȓ: "R",
|
|
213
|
+
ȓ: "r",
|
|
214
|
+
Ś: "S",
|
|
215
|
+
ś: "s",
|
|
216
|
+
Ŝ: "S",
|
|
217
|
+
ŝ: "s",
|
|
218
|
+
Ş: "S",
|
|
219
|
+
Ș: "S",
|
|
220
|
+
ș: "s",
|
|
221
|
+
ş: "s",
|
|
222
|
+
Š: "S",
|
|
223
|
+
š: "s",
|
|
224
|
+
Ţ: "T",
|
|
225
|
+
ţ: "t",
|
|
226
|
+
ț: "t",
|
|
227
|
+
Ț: "T",
|
|
228
|
+
Ť: "T",
|
|
229
|
+
ť: "t",
|
|
230
|
+
Ŧ: "T",
|
|
231
|
+
ŧ: "t",
|
|
232
|
+
T̆: "T",
|
|
233
|
+
t̆: "t",
|
|
234
|
+
Ũ: "U",
|
|
235
|
+
ũ: "u",
|
|
236
|
+
Ū: "U",
|
|
237
|
+
ū: "u",
|
|
238
|
+
Ŭ: "U",
|
|
239
|
+
ŭ: "u",
|
|
240
|
+
Ů: "U",
|
|
241
|
+
ů: "u",
|
|
242
|
+
Ű: "U",
|
|
243
|
+
ű: "u",
|
|
244
|
+
Ų: "U",
|
|
245
|
+
ų: "u",
|
|
246
|
+
Ȗ: "U",
|
|
247
|
+
ȗ: "u",
|
|
248
|
+
V̆: "V",
|
|
249
|
+
v̆: "v",
|
|
250
|
+
Ŵ: "W",
|
|
251
|
+
ŵ: "w",
|
|
252
|
+
Ẃ: "W",
|
|
253
|
+
ẃ: "w",
|
|
254
|
+
X̆: "X",
|
|
255
|
+
x̆: "x",
|
|
256
|
+
Ŷ: "Y",
|
|
257
|
+
ŷ: "y",
|
|
258
|
+
Ÿ: "Y",
|
|
259
|
+
Y̆: "Y",
|
|
260
|
+
y̆: "y",
|
|
261
|
+
Ź: "Z",
|
|
262
|
+
ź: "z",
|
|
263
|
+
Ż: "Z",
|
|
264
|
+
ż: "z",
|
|
265
|
+
Ž: "Z",
|
|
266
|
+
ž: "z",
|
|
267
|
+
ſ: "s",
|
|
268
|
+
ƒ: "f",
|
|
269
|
+
Ơ: "O",
|
|
270
|
+
ơ: "o",
|
|
271
|
+
Ư: "U",
|
|
272
|
+
ư: "u",
|
|
273
|
+
Ǎ: "A",
|
|
274
|
+
ǎ: "a",
|
|
275
|
+
Ǐ: "I",
|
|
276
|
+
ǐ: "i",
|
|
277
|
+
Ǒ: "O",
|
|
278
|
+
ǒ: "o",
|
|
279
|
+
Ǔ: "U",
|
|
280
|
+
ǔ: "u",
|
|
281
|
+
Ǖ: "U",
|
|
282
|
+
ǖ: "u",
|
|
283
|
+
Ǘ: "U",
|
|
284
|
+
ǘ: "u",
|
|
285
|
+
Ǚ: "U",
|
|
286
|
+
ǚ: "u",
|
|
287
|
+
Ǜ: "U",
|
|
288
|
+
ǜ: "u",
|
|
289
|
+
Ứ: "U",
|
|
290
|
+
ứ: "u",
|
|
291
|
+
Ṹ: "U",
|
|
292
|
+
ṹ: "u",
|
|
293
|
+
Ǻ: "A",
|
|
294
|
+
ǻ: "a",
|
|
295
|
+
Ǽ: "AE",
|
|
296
|
+
ǽ: "ae",
|
|
297
|
+
Ǿ: "O",
|
|
298
|
+
ǿ: "o",
|
|
299
|
+
Þ: "TH",
|
|
300
|
+
þ: "th",
|
|
301
|
+
Ṕ: "P",
|
|
302
|
+
ṕ: "p",
|
|
303
|
+
Ṥ: "S",
|
|
304
|
+
ṥ: "s",
|
|
305
|
+
X́: "X",
|
|
306
|
+
x́: "x",
|
|
307
|
+
Ѓ: "Г",
|
|
308
|
+
ѓ: "г",
|
|
309
|
+
Ќ: "К",
|
|
310
|
+
ќ: "к",
|
|
311
|
+
A̋: "A",
|
|
312
|
+
a̋: "a",
|
|
313
|
+
E̋: "E",
|
|
314
|
+
e̋: "e",
|
|
315
|
+
I̋: "I",
|
|
316
|
+
i̋: "i",
|
|
317
|
+
Ǹ: "N",
|
|
318
|
+
ǹ: "n",
|
|
319
|
+
Ồ: "O",
|
|
320
|
+
ồ: "o",
|
|
321
|
+
Ṑ: "O",
|
|
322
|
+
ṑ: "o",
|
|
323
|
+
Ừ: "U",
|
|
324
|
+
ừ: "u",
|
|
325
|
+
Ẁ: "W",
|
|
326
|
+
ẁ: "w",
|
|
327
|
+
Ỳ: "Y",
|
|
328
|
+
ỳ: "y",
|
|
329
|
+
Ȁ: "A",
|
|
330
|
+
ȁ: "a",
|
|
331
|
+
Ȅ: "E",
|
|
332
|
+
ȅ: "e",
|
|
333
|
+
Ȉ: "I",
|
|
334
|
+
ȉ: "i",
|
|
335
|
+
Ȍ: "O",
|
|
336
|
+
ȍ: "o",
|
|
337
|
+
Ȑ: "R",
|
|
338
|
+
ȑ: "r",
|
|
339
|
+
Ȕ: "U",
|
|
340
|
+
ȕ: "u",
|
|
341
|
+
B̌: "B",
|
|
342
|
+
b̌: "b",
|
|
343
|
+
Č̣: "C",
|
|
344
|
+
č̣: "c",
|
|
345
|
+
Ê̌: "E",
|
|
346
|
+
ê̌: "e",
|
|
347
|
+
F̌: "F",
|
|
348
|
+
f̌: "f",
|
|
349
|
+
Ǧ: "G",
|
|
350
|
+
ǧ: "g",
|
|
351
|
+
Ȟ: "H",
|
|
352
|
+
ȟ: "h",
|
|
353
|
+
J̌: "J",
|
|
354
|
+
ǰ: "j",
|
|
355
|
+
Ǩ: "K",
|
|
356
|
+
ǩ: "k",
|
|
357
|
+
M̌: "M",
|
|
358
|
+
m̌: "m",
|
|
359
|
+
P̌: "P",
|
|
360
|
+
p̌: "p",
|
|
361
|
+
Q̌: "Q",
|
|
362
|
+
q̌: "q",
|
|
363
|
+
Ř̩: "R",
|
|
364
|
+
ř̩: "r",
|
|
365
|
+
Ṧ: "S",
|
|
366
|
+
ṧ: "s",
|
|
367
|
+
V̌: "V",
|
|
368
|
+
v̌: "v",
|
|
369
|
+
W̌: "W",
|
|
370
|
+
w̌: "w",
|
|
371
|
+
X̌: "X",
|
|
372
|
+
x̌: "x",
|
|
373
|
+
Y̌: "Y",
|
|
374
|
+
y̌: "y",
|
|
375
|
+
A̧: "A",
|
|
376
|
+
a̧: "a",
|
|
377
|
+
B̧: "B",
|
|
378
|
+
b̧: "b",
|
|
379
|
+
Ḑ: "D",
|
|
380
|
+
ḑ: "d",
|
|
381
|
+
Ȩ: "E",
|
|
382
|
+
ȩ: "e",
|
|
383
|
+
Ɛ̧: "E",
|
|
384
|
+
ɛ̧: "e",
|
|
385
|
+
Ḩ: "H",
|
|
386
|
+
ḩ: "h",
|
|
387
|
+
I̧: "I",
|
|
388
|
+
i̧: "i",
|
|
389
|
+
Ɨ̧: "I",
|
|
390
|
+
ɨ̧: "i",
|
|
391
|
+
M̧: "M",
|
|
392
|
+
m̧: "m",
|
|
393
|
+
O̧: "O",
|
|
394
|
+
o̧: "o",
|
|
395
|
+
Q̧: "Q",
|
|
396
|
+
q̧: "q",
|
|
397
|
+
U̧: "U",
|
|
398
|
+
u̧: "u",
|
|
399
|
+
X̧: "X",
|
|
400
|
+
x̧: "x",
|
|
401
|
+
Z̧: "Z",
|
|
402
|
+
z̧: "z"
|
|
403
|
+
};
|
|
404
|
+
const chars = Object.keys(characterMap).join("|");
|
|
405
|
+
const allAccents = new RegExp(chars, "g");
|
|
406
|
+
/**
|
|
407
|
+
* Removes accents from a string.
|
|
408
|
+
*
|
|
409
|
+
* @param str - The string to remove accents from
|
|
410
|
+
* @returns The string without accents
|
|
411
|
+
*/
|
|
412
|
+
const removeAccents = (str) => str.replace(allAccents, (match) => characterMap[match]);
|
|
413
|
+
|
|
414
|
+
//#endregion
|
|
415
|
+
exports.removeAccents = removeAccents;
|