@alwatr/unicode-digits 5.5.29 → 6.0.0

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/dist/main.js ADDED
@@ -0,0 +1,5 @@
1
+ /* 📦 @alwatr/unicode-digits v6.0.0 */
2
+ var A={en:48,ar:1632,fa:1776,nko:1984,hi:2406,bn:2534,pa:2662,gu:2790,or:2918,ta:3046,te:3174,kn:3302,mal:3430,sinhala_lith:3558,thai:3664,lao:3792,tibetan:3872,myanmar:4160,myanmar_shan:4240,khmer:6112,mongolian:6160,limbu:6470,new_tai_lue:6608,tai_tham_hora:6784,tai_tham_tham:6800,balinese:6992,sundanese:7088,lepcha:7232,ol_chiki:7248,vai:42528,saurashtra:43216,kayah_li:43264,javanese:43472,myanmar_tai_laing:43504,cham:43600,meetei_mayek:44016,fullwidth:65296,osmanya:66720,brahmi:69734,sora_sompeng:69872,chakma:69942,sharada:70096,khudawadi:70384,newa:70736,tirhuta:70864,modi:71248,takri:71360,ahom:71472,warang_citi:71904,bhaiksuki:72784,mro:92768,pahawh_hmong:93008,mathematical_bold:120782,"mathematical_double-struck":120792,"mathematical_sans-serif":120802,"mathematical_sans-serif_bold":120812,mathematical_monospace:120822,fula:125264},G=["en","fa","ar"];class H{_toLangZeroCode;_searchRegExt;_replacer(k,...q){return String.fromCharCode(this._toLangZeroCode+q.findIndex((w)=>w!=null))}constructor(k,q=[...G]){if(q==="all")q=Object.keys(A);let w=q.indexOf(k);if(w!==-1)q.splice(w,1);this._toLangZeroCode=A[k];let B=[];for(let z=0;z<10;z++)B.push("("+q.map((F)=>String.fromCharCode(A[F]+z)).join("|")+")");this._searchRegExt=new RegExp(B.join("|"),"g"),this._replacer=this._replacer.bind(this)}translate(k){return k.trim()===""?k:k.replace(this._searchRegExt,this._replacer)}}export{H as UnicodeDigits};
3
+
4
+ //# debugId=963E0F8E3DCA372A64756E2164756E21
5
+ //# sourceMappingURL=main.js.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/main.ts"],
4
+ "sourcesContent": [
5
+ "const supportedLanguageList = {\n en: 0x0030,\n ar: 0x0660,\n fa: 0x06f0,\n nko: 0x07c0,\n hi: 0x0966, // devanagari\n bn: 0x09e6, // bengali\n pa: 0x0a66, // gurmukhi, punjabi\n gu: 0x0ae6, // gujarati\n or: 0x0b66, // oriya\n ta: 0x0be6, // tamil\n te: 0x0c66, // telugu\n kn: 0x0ce6, // kannada\n\n mal: 0x0d66, // malayalam\n sinhala_lith: 0x0de6,\n thai: 0x0e50,\n lao: 0x0ed0,\n tibetan: 0x0f20,\n myanmar: 0x1040,\n myanmar_shan: 0x1090,\n khmer: 0x17e0,\n mongolian: 0x1810,\n limbu: 0x1946,\n new_tai_lue: 0x19d0,\n tai_tham_hora: 0x1a80,\n tai_tham_tham: 0x1a90,\n balinese: 0x1b50,\n sundanese: 0x1bb0,\n lepcha: 0x1c40,\n ol_chiki: 0x1c50,\n vai: 0xa620,\n saurashtra: 0xa8d0,\n kayah_li: 0xa900,\n javanese: 0xa9d0,\n myanmar_tai_laing: 0xa9f0,\n cham: 0xaa50,\n meetei_mayek: 0xabf0,\n fullwidth: 0xff10,\n osmanya: 0x104a0,\n brahmi: 0x11066,\n sora_sompeng: 0x110f0,\n chakma: 0x11136,\n sharada: 0x111d0,\n khudawadi: 0x112f0,\n newa: 0x11450,\n tirhuta: 0x114d0,\n modi: 0x11650,\n takri: 0x116c0,\n ahom: 0x11730,\n warang_citi: 0x118e0,\n bhaiksuki: 0x11c50,\n mro: 0x16a60,\n pahawh_hmong: 0x16b50,\n mathematical_bold: 0x1d7ce,\n 'mathematical_double-struck': 0x1d7d8,\n 'mathematical_sans-serif': 0x1d7e2,\n 'mathematical_sans-serif_bold': 0x1d7ec,\n mathematical_monospace: 0x1d7f6,\n fula: 0x1e950, // adlam script in fula lang\n} as const;\n\nexport type UnicodeLangKeys = keyof typeof supportedLanguageList;\n\nconst commonLangList: UnicodeLangKeys[] = ['en', 'fa', 'ar'];\n\nexport class UnicodeDigits {\n protected _toLangZeroCode;\n protected _searchRegExt;\n\n protected _replacer(_: string, ...args: number[]): string {\n return String.fromCharCode(this._toLangZeroCode + args.findIndex((v) => v != null));\n }\n\n /**\n * Translate number.\n *\n * Example:\n *\n * ```ts\n * const unicodeDigits = new UnicodeDigits('en');\n *\n * const list = [\n * '0123456789',\n * '٠١٢٣٤٥٦٧٨٩',\n * '߀߁߂߃߄߅߆߇߈߉',\n * '०१२३४५६७८९',\n * '০১২৩৪৫৬৭৮৯',\n * '੦੧੨੩੪੫੬੭੮੯',\n * '૦૧૨૩૪૫૬૭૮૯',\n * '୦୧୨୩୪୫୬୭୮୯',\n * '௦௧௨௩௪௫௬௭௮௯',\n * ].join('\\n');\n *\n * console.log(unicodeDigits.translate(list));\n * ```\n */\n constructor(toLanguage: UnicodeLangKeys, fromLanguages: UnicodeLangKeys[] | 'all' = [...commonLangList]) {\n if (fromLanguages === 'all') {\n fromLanguages = Object.keys(supportedLanguageList) as UnicodeLangKeys[];\n }\n\n const removeSelf = fromLanguages.indexOf(toLanguage);\n if (removeSelf !== -1) fromLanguages.splice(removeSelf, 1);\n\n this._toLangZeroCode = supportedLanguageList[toLanguage];\n\n const regParts: string[] = [];\n for (let n = 0; n < 10; n++) {\n regParts.push('(' + fromLanguages.map((langKey) => String.fromCharCode(supportedLanguageList[langKey] + n)).join('|') + ')');\n }\n this._searchRegExt = new RegExp(regParts.join('|'), 'g');\n this._replacer = this._replacer.bind(this);\n }\n\n /**\n * Convert the String of number of the source language to the destination language.\n *\n * @param {string} str - String of number of the source language.\n * @returns String of number of the destination language.\n *\n * Example:\n *\n * ```ts\n * const list = [\n * '0123456789',\n * '٠١٢٣٤٥٦٧٨٩',\n * '߀߁߂߃߄߅߆߇߈߉',\n * '०१२३४५६७८९',\n * '০১২৩৪৫৬৭৮৯',\n * '੦੧੨੩੪੫੬੭੮੯',\n * '૦૧૨૩૪૫૬૭૮૯',\n * '୦୧୨୩୪୫୬୭୮୯',\n * '௦௧௨௩௪௫௬௭௮௯',\n * ].join('\\n');\n *\n * console.log(unicodeDigits.translate(list));\n * ```\n */\n public translate(str: string): string {\n return str.trim() === '' ? str : str.replace(this._searchRegExt, this._replacer);\n }\n}\n"
6
+ ],
7
+ "mappings": ";AAAA,IAAM,EAAwB,CAC5B,GAAI,GACJ,GAAI,KACJ,GAAI,KACJ,IAAK,KACL,GAAI,KACJ,GAAI,KACJ,GAAI,KACJ,GAAI,KACJ,GAAI,KACJ,GAAI,KACJ,GAAI,KACJ,GAAI,KAEJ,IAAK,KACL,aAAc,KACd,KAAM,KACN,IAAK,KACL,QAAS,KACT,QAAS,KACT,aAAc,KACd,MAAO,KACP,UAAW,KACX,MAAO,KACP,YAAa,KACb,cAAe,KACf,cAAe,KACf,SAAU,KACV,UAAW,KACX,OAAQ,KACR,SAAU,KACV,IAAK,MACL,WAAY,MACZ,SAAU,MACV,SAAU,MACV,kBAAmB,MACnB,KAAM,MACN,aAAc,MACd,UAAW,MACX,QAAS,MACT,OAAQ,MACR,aAAc,MACd,OAAQ,MACR,QAAS,MACT,UAAW,MACX,KAAM,MACN,QAAS,MACT,KAAM,MACN,MAAO,MACP,KAAM,MACN,YAAa,MACb,UAAW,MACX,IAAK,MACL,aAAc,MACd,kBAAmB,OACnB,6BAA8B,OAC9B,0BAA2B,OAC3B,+BAAgC,OAChC,uBAAwB,OACxB,KAAM,MACR,EAIM,EAAoC,CAAC,KAAM,KAAM,IAAI,EAEpD,MAAM,CAAc,CACf,gBACA,cAEA,SAAS,CAAC,KAAc,EAAwB,CACxD,OAAO,OAAO,aAAa,KAAK,gBAAkB,EAAK,UAAU,CAAC,IAAM,GAAK,IAAI,CAAC,EA0BpF,WAAW,CAAC,EAA6B,EAA2C,CAAC,GAAG,CAAc,EAAG,CACvG,GAAI,IAAkB,MACpB,EAAgB,OAAO,KAAK,CAAqB,EAGnD,IAAM,EAAa,EAAc,QAAQ,CAAU,EACnD,GAAI,IAAe,GAAI,EAAc,OAAO,EAAY,CAAC,EAEzD,KAAK,gBAAkB,EAAsB,GAE7C,IAAM,EAAqB,CAAC,EAC5B,QAAS,EAAI,EAAG,EAAI,GAAI,IACtB,EAAS,KAAK,IAAM,EAAc,IAAI,CAAC,IAAY,OAAO,aAAa,EAAsB,GAAW,CAAC,CAAC,EAAE,KAAK,GAAG,EAAI,GAAG,EAE7H,KAAK,cAAgB,IAAI,OAAO,EAAS,KAAK,GAAG,EAAG,GAAG,EACvD,KAAK,UAAY,KAAK,UAAU,KAAK,IAAI,EA2BpC,SAAS,CAAC,EAAqB,CACpC,OAAO,EAAI,KAAK,IAAM,GAAK,EAAM,EAAI,QAAQ,KAAK,cAAe,KAAK,SAAS,EAEnF",
8
+ "debugId": "963E0F8E3DCA372A64756E2164756E21",
9
+ "names": []
10
+ }
package/package.json CHANGED
@@ -1,25 +1,25 @@
1
1
  {
2
2
  "name": "@alwatr/unicode-digits",
3
3
  "description": "Convert the String of number of the source language to the destination language.",
4
- "version": "5.5.29",
4
+ "version": "6.0.0",
5
5
  "author": "S. Ali Mihandoost <ali.mihandoost@gmail.com>",
6
6
  "bugs": "https://github.com/Alwatr/nanolib/issues",
7
7
  "devDependencies": {
8
- "@alwatr/nano-build": "6.4.2",
9
- "@alwatr/prettier-config": "6.0.2",
10
- "@alwatr/tsconfig-base": "6.0.4",
11
- "@alwatr/type-helper": "7.0.2",
8
+ "@alwatr/nano-build": "7.0.0",
9
+ "@alwatr/prettier-config": "7.0.0",
10
+ "@alwatr/tsconfig-base": "7.0.0",
11
+ "@alwatr/type-helper": "8.0.0",
12
12
  "typescript": "^5.9.3"
13
13
  },
14
14
  "exports": {
15
15
  ".": {
16
16
  "types": "./dist/main.d.ts",
17
- "import": "./dist/main.mjs",
18
- "require": "./dist/main.cjs"
17
+ "default": "./dist/main.js"
19
18
  }
20
19
  },
21
20
  "files": [
22
- "**/*.{js,mjs,cjs,map,d.ts,html,md,LEGAL.txt}",
21
+ "**/*.{js,mjs,cjs,ts,map,d.ts,html,LEGAL.txt}",
22
+ "README.md",
23
23
  "LICENSE",
24
24
  "!demo/**/*",
25
25
  "!**/*.test.js"
@@ -43,8 +43,6 @@
43
43
  "utils"
44
44
  ],
45
45
  "license": "MPL-2.0",
46
- "main": "./dist/main.cjs",
47
- "module": "./dist/main.mjs",
48
46
  "prettier": "@alwatr/prettier-config",
49
47
  "publishConfig": {
50
48
  "access": "public"
@@ -57,14 +55,14 @@
57
55
  "scripts": {
58
56
  "b": "bun run build",
59
57
  "build": "bun run build:ts && bun run build:es",
60
- "build:es": "nano-build --preset=module",
58
+ "build:es": "nano-build --preset=module src/main.ts",
61
59
  "build:ts": "tsc --build",
62
60
  "c": "bun run clean",
63
61
  "cb": "bun run clean && bun run build",
64
62
  "clean": "rm -rfv dist *.tsbuildinfo",
65
- "d": "bun run build:es && bun --enable-source-maps --trace-warnings",
63
+ "d": "bun run build:es && bun",
66
64
  "t": "bun run test",
67
- "test": "echo test-skipped",
65
+ "test": "bun test",
68
66
  "w": "bun run watch",
69
67
  "watch": "bun run watch:ts & bun run watch:es",
70
68
  "watch:es": "bun run build:es --watch",
@@ -73,5 +71,5 @@
73
71
  "sideEffects": false,
74
72
  "type": "module",
75
73
  "types": "./dist/main.d.ts",
76
- "gitHead": "c3889e3756b0a0f9b935a1b702a1373ac52cb379"
74
+ "gitHead": "056102a1c8a563bbae8a290b6830450f467322a3"
77
75
  }
package/src/main.ts ADDED
@@ -0,0 +1,143 @@
1
+ const supportedLanguageList = {
2
+ en: 0x0030,
3
+ ar: 0x0660,
4
+ fa: 0x06f0,
5
+ nko: 0x07c0,
6
+ hi: 0x0966, // devanagari
7
+ bn: 0x09e6, // bengali
8
+ pa: 0x0a66, // gurmukhi, punjabi
9
+ gu: 0x0ae6, // gujarati
10
+ or: 0x0b66, // oriya
11
+ ta: 0x0be6, // tamil
12
+ te: 0x0c66, // telugu
13
+ kn: 0x0ce6, // kannada
14
+
15
+ mal: 0x0d66, // malayalam
16
+ sinhala_lith: 0x0de6,
17
+ thai: 0x0e50,
18
+ lao: 0x0ed0,
19
+ tibetan: 0x0f20,
20
+ myanmar: 0x1040,
21
+ myanmar_shan: 0x1090,
22
+ khmer: 0x17e0,
23
+ mongolian: 0x1810,
24
+ limbu: 0x1946,
25
+ new_tai_lue: 0x19d0,
26
+ tai_tham_hora: 0x1a80,
27
+ tai_tham_tham: 0x1a90,
28
+ balinese: 0x1b50,
29
+ sundanese: 0x1bb0,
30
+ lepcha: 0x1c40,
31
+ ol_chiki: 0x1c50,
32
+ vai: 0xa620,
33
+ saurashtra: 0xa8d0,
34
+ kayah_li: 0xa900,
35
+ javanese: 0xa9d0,
36
+ myanmar_tai_laing: 0xa9f0,
37
+ cham: 0xaa50,
38
+ meetei_mayek: 0xabf0,
39
+ fullwidth: 0xff10,
40
+ osmanya: 0x104a0,
41
+ brahmi: 0x11066,
42
+ sora_sompeng: 0x110f0,
43
+ chakma: 0x11136,
44
+ sharada: 0x111d0,
45
+ khudawadi: 0x112f0,
46
+ newa: 0x11450,
47
+ tirhuta: 0x114d0,
48
+ modi: 0x11650,
49
+ takri: 0x116c0,
50
+ ahom: 0x11730,
51
+ warang_citi: 0x118e0,
52
+ bhaiksuki: 0x11c50,
53
+ mro: 0x16a60,
54
+ pahawh_hmong: 0x16b50,
55
+ mathematical_bold: 0x1d7ce,
56
+ 'mathematical_double-struck': 0x1d7d8,
57
+ 'mathematical_sans-serif': 0x1d7e2,
58
+ 'mathematical_sans-serif_bold': 0x1d7ec,
59
+ mathematical_monospace: 0x1d7f6,
60
+ fula: 0x1e950, // adlam script in fula lang
61
+ } as const;
62
+
63
+ export type UnicodeLangKeys = keyof typeof supportedLanguageList;
64
+
65
+ const commonLangList: UnicodeLangKeys[] = ['en', 'fa', 'ar'];
66
+
67
+ export class UnicodeDigits {
68
+ protected _toLangZeroCode;
69
+ protected _searchRegExt;
70
+
71
+ protected _replacer(_: string, ...args: number[]): string {
72
+ return String.fromCharCode(this._toLangZeroCode + args.findIndex((v) => v != null));
73
+ }
74
+
75
+ /**
76
+ * Translate number.
77
+ *
78
+ * Example:
79
+ *
80
+ * ```ts
81
+ * const unicodeDigits = new UnicodeDigits('en');
82
+ *
83
+ * const list = [
84
+ * '0123456789',
85
+ * '٠١٢٣٤٥٦٧٨٩',
86
+ * '߀߁߂߃߄߅߆߇߈߉',
87
+ * '०१२३४५६७८९',
88
+ * '০১২৩৪৫৬৭৮৯',
89
+ * '੦੧੨੩੪੫੬੭੮੯',
90
+ * '૦૧૨૩૪૫૬૭૮૯',
91
+ * '୦୧୨୩୪୫୬୭୮୯',
92
+ * '௦௧௨௩௪௫௬௭௮௯',
93
+ * ].join('\n');
94
+ *
95
+ * console.log(unicodeDigits.translate(list));
96
+ * ```
97
+ */
98
+ constructor(toLanguage: UnicodeLangKeys, fromLanguages: UnicodeLangKeys[] | 'all' = [...commonLangList]) {
99
+ if (fromLanguages === 'all') {
100
+ fromLanguages = Object.keys(supportedLanguageList) as UnicodeLangKeys[];
101
+ }
102
+
103
+ const removeSelf = fromLanguages.indexOf(toLanguage);
104
+ if (removeSelf !== -1) fromLanguages.splice(removeSelf, 1);
105
+
106
+ this._toLangZeroCode = supportedLanguageList[toLanguage];
107
+
108
+ const regParts: string[] = [];
109
+ for (let n = 0; n < 10; n++) {
110
+ regParts.push('(' + fromLanguages.map((langKey) => String.fromCharCode(supportedLanguageList[langKey] + n)).join('|') + ')');
111
+ }
112
+ this._searchRegExt = new RegExp(regParts.join('|'), 'g');
113
+ this._replacer = this._replacer.bind(this);
114
+ }
115
+
116
+ /**
117
+ * Convert the String of number of the source language to the destination language.
118
+ *
119
+ * @param {string} str - String of number of the source language.
120
+ * @returns String of number of the destination language.
121
+ *
122
+ * Example:
123
+ *
124
+ * ```ts
125
+ * const list = [
126
+ * '0123456789',
127
+ * '٠١٢٣٤٥٦٧٨٩',
128
+ * '߀߁߂߃߄߅߆߇߈߉',
129
+ * '०१२३४५६७८९',
130
+ * '০১২৩৪৫৬৭৮৯',
131
+ * '੦੧੨੩੪੫੬੭੮੯',
132
+ * '૦૧૨૩૪૫૬૭૮૯',
133
+ * '୦୧୨୩୪୫୬୭୮୯',
134
+ * '௦௧௨௩௪௫௬௭௮௯',
135
+ * ].join('\n');
136
+ *
137
+ * console.log(unicodeDigits.translate(list));
138
+ * ```
139
+ */
140
+ public translate(str: string): string {
141
+ return str.trim() === '' ? str : str.replace(this._searchRegExt, this._replacer);
142
+ }
143
+ }
package/CHANGELOG.md DELETED
@@ -1,249 +0,0 @@
1
- # Change Log
2
-
3
- All notable changes to this project will be documented in this file.
4
- See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
-
6
- ## [5.5.29](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@5.5.28...@alwatr/unicode-digits@5.5.29) (2026-03-16)
7
-
8
- ### 🔨 Code Refactoring
9
-
10
- * migrate build scripts from yarn to bun across multiple packages ([d90e962](https://github.com/Alwatr/nanolib/commit/d90e962f15e5c951e191d5f02341279b6472abc3))
11
-
12
- ## [5.5.28](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@5.5.27...@alwatr/unicode-digits@5.5.28) (2026-02-18)
13
-
14
- **Note:** Version bump only for package @alwatr/unicode-digits
15
-
16
- ## [5.5.27](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@5.5.26...@alwatr/unicode-digits@5.5.27) (2025-12-23)
17
-
18
- **Note:** Version bump only for package @alwatr/unicode-digits
19
-
20
- ## [5.5.26](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@5.5.25...@alwatr/unicode-digits@5.5.26) (2025-12-13)
21
-
22
- **Note:** Version bump only for package @alwatr/unicode-digits
23
-
24
- ## [5.5.25](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@5.5.24...@alwatr/unicode-digits@5.5.25) (2025-12-10)
25
-
26
- **Note:** Version bump only for package @alwatr/unicode-digits
27
-
28
- ## [5.5.24](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@5.5.23...@alwatr/unicode-digits@5.5.24) (2025-11-18)
29
-
30
- ### 🔨 Code Refactoring
31
-
32
- * remove unnecessary type declarations from tsconfig.json files ([89bcc7d](https://github.com/Alwatr/nanolib/commit/89bcc7db839807110b80f8ba34414ea9734d9c75))
33
-
34
- ## [5.5.23](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@5.5.22...@alwatr/unicode-digits@5.5.23) (2025-11-15)
35
-
36
- **Note:** Version bump only for package @alwatr/unicode-digits
37
-
38
- ## [5.5.22](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@5.5.21...@alwatr/unicode-digits@5.5.22) (2025-11-15)
39
-
40
- **Note:** Version bump only for package @alwatr/unicode-digits
41
-
42
- ## [5.5.21](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@5.5.20...@alwatr/unicode-digits@5.5.21) (2025-11-04)
43
-
44
- **Note:** Version bump only for package @alwatr/unicode-digits
45
-
46
- ## [5.5.20](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@5.5.19...@alwatr/unicode-digits@5.5.20) (2025-10-06)
47
-
48
- ### 🔗 Dependencies update
49
-
50
- * bump the npm-dependencies group with 4 updates ([9825815](https://github.com/Alwatr/nanolib/commit/982581552bbb4b97dca52af5e93a80937f0c3109))
51
-
52
- ## [5.5.19](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@5.5.18...@alwatr/unicode-digits@5.5.19) (2025-09-27)
53
-
54
- ### 🧹 Miscellaneous Chores
55
-
56
- * exclude test files from package distribution ([86f4f2f](https://github.com/Alwatr/nanolib/commit/86f4f2f5985845c5cf3a3a9398de7b2f98ce53e7))
57
-
58
- ## [5.5.18](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@5.5.17...@alwatr/unicode-digits@5.5.18) (2025-09-22)
59
-
60
- **Note:** Version bump only for package @alwatr/unicode-digits
61
-
62
- ## [5.5.17](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@5.5.16...@alwatr/unicode-digits@5.5.17) (2025-09-22)
63
-
64
- **Note:** Version bump only for package @alwatr/unicode-digits
65
-
66
- ## [5.5.16](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@5.5.15...@alwatr/unicode-digits@5.5.16) (2025-09-21)
67
-
68
- **Note:** Version bump only for package @alwatr/unicode-digits
69
-
70
- ## [5.5.15](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@5.5.14...@alwatr/unicode-digits@5.5.15) (2025-09-20)
71
-
72
- ### 🐛 Bug Fixes
73
-
74
- * add sideEffects property to package.json files for better tree-shaking ([c7b9e74](https://github.com/Alwatr/nanolib/commit/c7b9e74e1920c8e35b438742de61883ca62da58c))
75
- * add sideEffects property to package.json files for better tree-shaking ([e8402c4](https://github.com/Alwatr/nanolib/commit/e8402c481a14a1f807a37aaa862a936713d26176))
76
-
77
- ### 🧹 Miscellaneous Chores
78
-
79
- * remove duplicate sideEffects property from multiple package.json files ([b123f86](https://github.com/Alwatr/nanolib/commit/b123f86be81481de2314aae9bb2eeb629743d24c))
80
-
81
- ## [5.5.14](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@5.5.13...@alwatr/unicode-digits@5.5.14) (2025-09-19)
82
-
83
- **Note:** Version bump only for package @alwatr/unicode-digits
84
-
85
- ## [5.5.13](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@5.5.12...@alwatr/unicode-digits@5.5.13) (2025-09-15)
86
-
87
- **Note:** Version bump only for package @alwatr/unicode-digits
88
-
89
- ## [5.5.12](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@5.5.11...@alwatr/unicode-digits@5.5.12) (2025-09-13)
90
-
91
- **Note:** Version bump only for package @alwatr/unicode-digits
92
-
93
- ## [5.5.11](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@5.5.10...@alwatr/unicode-digits@5.5.11) (2025-09-13)
94
-
95
- ### 🧹 Miscellaneous Chores
96
-
97
- * remove package-tracer dependency and related code from fetch package ([96fe4e9](https://github.com/Alwatr/nanolib/commit/96fe4e9552a205f218ceed187c55e4e904a07089))
98
-
99
- ## [5.5.10](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@5.5.9...@alwatr/unicode-digits@5.5.10) (2025-09-09)
100
-
101
- ### 🧹 Miscellaneous Chores
102
-
103
- * remove trailing newlines from contributing sections in README files ([e8ab1bc](https://github.com/Alwatr/nanolib/commit/e8ab1bc43e0addea5ccd4c897c2cec597cb9e15f))
104
-
105
- ## [5.5.9](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@5.5.8...@alwatr/unicode-digits@5.5.9) (2025-09-06)
106
-
107
- **Note:** Version bump only for package @alwatr/unicode-digits
108
-
109
- ## [5.5.8](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@5.5.7...@alwatr/unicode-digits@5.5.8) (2025-09-05)
110
-
111
- **Note:** Version bump only for package @alwatr/unicode-digits
112
-
113
- ## [5.5.7](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@5.5.6...@alwatr/unicode-digits@5.5.7) (2025-09-01)
114
-
115
- **Note:** Version bump only for package @alwatr/unicode-digits
116
-
117
- ## [5.5.6](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@5.5.5...@alwatr/unicode-digits@5.5.6) (2025-08-23)
118
-
119
- **Note:** Version bump only for package @alwatr/unicode-digits
120
-
121
- ## [5.5.5](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@5.5.3...@alwatr/unicode-digits@5.5.5) (2025-08-23)
122
-
123
- ### 🐛 Bug Fixes
124
-
125
- * update license from AGPL-3.0-only to MPL-2.0 ([d20968e](https://github.com/Alwatr/nanolib/commit/d20968e60cc89b1dcdf9b96507178da6ed562f55))
126
- * update package versions in multiple package.json files ([7638b1c](https://github.com/Alwatr/nanolib/commit/7638b1cafee2b4e0f97db7a89ac9fba6384b9b10))
127
-
128
- ### 🔨 Code Refactoring
129
-
130
- * Updated all package.json files in the project to change dependency version specifiers from "workspace:^" to "workspace:*" for consistency and to allow for more flexible version resolution. ([db6a4f7](https://github.com/Alwatr/nanolib/commit/db6a4f76deec2d1d8039978144e4bc51b6f1a0e3))
131
-
132
- ### 🧹 Miscellaneous Chores
133
-
134
- * reformat all package.json files ([ceda45d](https://github.com/Alwatr/nanolib/commit/ceda45de186667790474f729cb4b161a5148ce19))
135
-
136
- ### 🔗 Dependencies update
137
-
138
- * update TypeScript and Jest versions across all packages to improve compatibility and performance ([31baf36](https://github.com/Alwatr/nanolib/commit/31baf366101e92e27db66a21c849fb101f19be47))
139
-
140
- ## [5.5.4](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@5.5.3...@alwatr/unicode-digits@5.5.4) (2025-08-23)
141
-
142
- ### Code Refactoring
143
-
144
- * Updated all package.json files in the project to change dependency version specifiers from "workspace:^" to "workspace:*" for consistency and to allow for more flexible version resolution. ([db6a4f7](https://github.com/Alwatr/nanolib/commit/db6a4f76deec2d1d8039978144e4bc51b6f1a0e3)) by @alimd
145
-
146
- ## <small>5.5.3 (2025-04-15)</small>
147
-
148
- **Note:** Version bump only for package @alwatr/unicode-digits
149
-
150
- ## [5.5.2](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@5.5.1...@alwatr/unicode-digits@5.5.2) (2025-04-01)
151
-
152
- **Note:** Version bump only for package @alwatr/unicode-digits
153
-
154
- ## [5.5.1](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@5.5.0...@alwatr/unicode-digits@5.5.1) (2025-03-18)
155
-
156
- **Note:** Version bump only for package @alwatr/unicode-digits
157
-
158
- ## [5.5.0](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@5.4.0...@alwatr/unicode-digits@5.5.0) (2025-03-06)
159
-
160
- ### Miscellaneous Chores
161
-
162
- * update username casing in changelog entries ([9722ac9](https://github.com/Alwatr/nanolib/commit/9722ac9a078438a4e8ebfa5826ea70e0e3a52ca6)) by @
163
-
164
- ### Dependencies update
165
-
166
- * bump the development-dependencies group across 1 directory with 11 updates ([720c395](https://github.com/Alwatr/nanolib/commit/720c3954da55c929fe8fb16957121f4c51fb7f0c)) by @dependabot[bot]
167
-
168
- ## [5.4.0](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@1.1.3...@alwatr/unicode-digits@5.4.0) (2025-02-18)
169
-
170
- ## 5.3.0 (2025-02-03)
171
-
172
- ### Miscellaneous Chores
173
-
174
- * edit README ([3860b3d](https://github.com/Alwatr/nanolib/commit/3860b3df48ab82dc479d5236c2e8579df614aabf)) by @
175
-
176
- ### Dependencies update
177
-
178
- * bump the development-dependencies group across 1 directory with 11 updates ([cb79d07](https://github.com/Alwatr/nanolib/commit/cb79d072a57c79e1c01abff1a293d6757bb65350)) by @
179
- * update typescript and @types/node to version 5.7.3 and 22.13.0 respectively across multiple packages ([ddab05b](https://github.com/Alwatr/nanolib/commit/ddab05b5d767c30191f36a065e4bc88744e8e3fe)) by @
180
-
181
- ## 5.0.0 (2024-11-02)
182
-
183
- ### ⚠ BREAKING CHANGES
184
-
185
- * To simplify version management and ensure consistency, all nanolib packages now use the same version as @alwatr/nanolib. This may require updates to your project's dependencies.
186
-
187
- ### Code Refactoring
188
-
189
- * use the same version as @alwatr/nanolib ([60eb860](https://github.com/Alwatr/nanolib/commit/60eb860a0e33dfffe2d1d95e63ce54c60876be06)) by @
190
-
191
- ## [5.3.0](https://github.com/Alwatr/nanolib/compare/v5.2.1...v5.3.0) (2025-02-03)
192
-
193
- ### Miscellaneous Chores
194
-
195
- * edit README ([3860b3d](https://github.com/Alwatr/nanolib/commit/3860b3df48ab82dc479d5236c2e8579df614aabf)) by @ArmanAsadian
196
-
197
- ### Dependencies update
198
-
199
- * bump the development-dependencies group across 1 directory with 11 updates ([cb79d07](https://github.com/Alwatr/nanolib/commit/cb79d072a57c79e1c01abff1a293d6757bb65350)) by @dependabot[bot]
200
- * update typescript and @types/node to version 5.7.3 and 22.13.0 respectively across multiple packages ([ddab05b](https://github.com/Alwatr/nanolib/commit/ddab05b5d767c30191f36a065e4bc88744e8e3fe)) by @alimd
201
-
202
- ## 5.0.0 (2024-11-02)
203
-
204
- ### ⚠ BREAKING CHANGES
205
-
206
- * To simplify version management and ensure consistency, all nanolib packages now use the same version as @alwatr/nanolib. This may require updates to your project's dependencies.
207
-
208
- ### Features
209
-
210
- * **unicode-digits:** add `unicode-digits` package ([2ee138e](https://github.com/Alwatr/nanolib/commit/2ee138e5532c44ad186a340d18fc2a22c619259c)) by @
211
- * **unicode-digits:** use `packageTracer` ([425e3f9](https://github.com/Alwatr/nanolib/commit/425e3f920b5d82dad8a4db283201dfefd370e4de)) by @
212
-
213
- ### Code Refactoring
214
-
215
- * use the same version as @alwatr/nanolib ([60eb860](https://github.com/Alwatr/nanolib/commit/60eb860a0e33dfffe2d1d95e63ce54c60876be06)) by @
216
-
217
- ### Miscellaneous Chores
218
-
219
- * include LICENSE and LEGAL files to publish ([09f366f](https://github.com/Alwatr/nanolib/commit/09f366f680bfa9fb26acb2cd1ccbc68c5a9e9ad8)) by @
220
-
221
- ## [1.1.3](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@1.1.2...@alwatr/unicode-digits@1.1.3) (2024-11-02)
222
-
223
- **Note:** Version bump only for package @alwatr/unicode-digits
224
-
225
- ## [1.1.2](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@1.1.1...@alwatr/unicode-digits@1.1.2) (2024-10-25)
226
-
227
- **Note:** Version bump only for package @alwatr/unicode-digits
228
-
229
- ## [1.1.1](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@1.1.0...@alwatr/unicode-digits@1.1.1) (2024-10-12)
230
-
231
- **Note:** Version bump only for package @alwatr/unicode-digits
232
-
233
- ## [1.1.0](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@1.0.1...@alwatr/unicode-digits@1.1.0) (2024-10-11)
234
-
235
- ### Features
236
-
237
- - **unicode-digits:** use `packageTracer` ([425e3f9](https://github.com/Alwatr/nanolib/commit/425e3f920b5d82dad8a4db283201dfefd370e4de)) by @mohammadhonarvar
238
-
239
- ## [1.0.1](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@1.0.0...@alwatr/unicode-digits@1.0.1) (2024-10-11)
240
-
241
- ### Miscellaneous Chores
242
-
243
- - include LICENSE and LEGAL files to publish ([09f366f](https://github.com/Alwatr/nanolib/commit/09f366f680bfa9fb26acb2cd1ccbc68c5a9e9ad8)) by @alimd
244
-
245
- ## 1.0.0 (2024-10-11)
246
-
247
- ### Features
248
-
249
- - **unicode-digits:** add `unicode-digits` package ([2ee138e](https://github.com/Alwatr/nanolib/commit/2ee138e5532c44ad186a340d18fc2a22c619259c)) by @mohammadhonarvar
package/dist/main.cjs DELETED
@@ -1,3 +0,0 @@
1
- /** 📦 @alwatr/unicode-digits v5.5.29 */
2
- "use strict";var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:true})};var __copyProps=(to,from,except,desc)=>{if(from&&typeof from==="object"||typeof from==="function"){for(let key of __getOwnPropNames(from))if(!__hasOwnProp.call(to,key)&&key!==except)__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable})}return to};var __toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:true}),mod);var main_exports={};__export(main_exports,{UnicodeDigits:()=>UnicodeDigits});module.exports=__toCommonJS(main_exports);var supportedLanguageList={en:48,ar:1632,fa:1776,nko:1984,hi:2406,bn:2534,pa:2662,gu:2790,or:2918,ta:3046,te:3174,kn:3302,mal:3430,sinhala_lith:3558,thai:3664,lao:3792,tibetan:3872,myanmar:4160,myanmar_shan:4240,khmer:6112,mongolian:6160,limbu:6470,new_tai_lue:6608,tai_tham_hora:6784,tai_tham_tham:6800,balinese:6992,sundanese:7088,lepcha:7232,ol_chiki:7248,vai:42528,saurashtra:43216,kayah_li:43264,javanese:43472,myanmar_tai_laing:43504,cham:43600,meetei_mayek:44016,fullwidth:65296,osmanya:66720,brahmi:69734,sora_sompeng:69872,chakma:69942,sharada:70096,khudawadi:70384,newa:70736,tirhuta:70864,modi:71248,takri:71360,ahom:71472,warang_citi:71904,bhaiksuki:72784,mro:92768,pahawh_hmong:93008,mathematical_bold:120782,"mathematical_double-struck":120792,"mathematical_sans-serif":120802,"mathematical_sans-serif_bold":120812,mathematical_monospace:120822,fula:125264};var commonLangList=["en","fa","ar"];var UnicodeDigits=class{_replacer(_,...args){return String.fromCharCode(this._toLangZeroCode+args.findIndex(v=>v!=null))}constructor(toLanguage,fromLanguages=[...commonLangList]){if(fromLanguages==="all"){fromLanguages=Object.keys(supportedLanguageList)}const removeSelf=fromLanguages.indexOf(toLanguage);if(removeSelf!==-1)fromLanguages.splice(removeSelf,1);this._toLangZeroCode=supportedLanguageList[toLanguage];const regParts=[];for(let n=0;n<10;n++){regParts.push("("+fromLanguages.map(langKey=>String.fromCharCode(supportedLanguageList[langKey]+n)).join("|")+")")}this._searchRegExt=new RegExp(regParts.join("|"),"g");this._replacer=this._replacer.bind(this)}translate(str){return str.trim()===""?str:str.replace(this._searchRegExt,this._replacer)}};0&&(module.exports={UnicodeDigits});
3
- //# sourceMappingURL=main.cjs.map
package/dist/main.cjs.map DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/main.ts"],
4
- "sourcesContent": ["const supportedLanguageList = {\n en: 0x0030,\n ar: 0x0660,\n fa: 0x06f0,\n nko: 0x07c0,\n hi: 0x0966, // devanagari\n bn: 0x09e6, // bengali\n pa: 0x0a66, // gurmukhi, punjabi\n gu: 0x0ae6, // gujarati\n or: 0x0b66, // oriya\n ta: 0x0be6, // tamil\n te: 0x0c66, // telugu\n kn: 0x0ce6, // kannada\n\n mal: 0x0d66, // malayalam\n sinhala_lith: 0x0de6,\n thai: 0x0e50,\n lao: 0x0ed0,\n tibetan: 0x0f20,\n myanmar: 0x1040,\n myanmar_shan: 0x1090,\n khmer: 0x17e0,\n mongolian: 0x1810,\n limbu: 0x1946,\n new_tai_lue: 0x19d0,\n tai_tham_hora: 0x1a80,\n tai_tham_tham: 0x1a90,\n balinese: 0x1b50,\n sundanese: 0x1bb0,\n lepcha: 0x1c40,\n ol_chiki: 0x1c50,\n vai: 0xa620,\n saurashtra: 0xa8d0,\n kayah_li: 0xa900,\n javanese: 0xa9d0,\n myanmar_tai_laing: 0xa9f0,\n cham: 0xaa50,\n meetei_mayek: 0xabf0,\n fullwidth: 0xff10,\n osmanya: 0x104a0,\n brahmi: 0x11066,\n sora_sompeng: 0x110f0,\n chakma: 0x11136,\n sharada: 0x111d0,\n khudawadi: 0x112f0,\n newa: 0x11450,\n tirhuta: 0x114d0,\n modi: 0x11650,\n takri: 0x116c0,\n ahom: 0x11730,\n warang_citi: 0x118e0,\n bhaiksuki: 0x11c50,\n mro: 0x16a60,\n pahawh_hmong: 0x16b50,\n mathematical_bold: 0x1d7ce,\n 'mathematical_double-struck': 0x1d7d8,\n 'mathematical_sans-serif': 0x1d7e2,\n 'mathematical_sans-serif_bold': 0x1d7ec,\n mathematical_monospace: 0x1d7f6,\n fula: 0x1e950, // adlam script in fula lang\n} as const;\n\nexport type UnicodeLangKeys = keyof typeof supportedLanguageList;\n\nconst commonLangList: UnicodeLangKeys[] = ['en', 'fa', 'ar'];\n\nexport class UnicodeDigits {\n protected _toLangZeroCode;\n protected _searchRegExt;\n\n protected _replacer(_: string, ...args: number[]): string {\n return String.fromCharCode(this._toLangZeroCode + args.findIndex((v) => v != null));\n }\n\n /**\n * Translate number.\n *\n * Example:\n *\n * ```ts\n * const unicodeDigits = new UnicodeDigits('en');\n *\n * const list = [\n * '0123456789',\n * '٠١٢٣٤٥٦٧٨٩',\n * '߀߁߂߃߄߅߆߇߈߉',\n * '०१२३४५६७८९',\n * '০১২৩৪৫৬৭৮৯',\n * '੦੧੨੩੪੫੬੭੮੯',\n * '૦૧૨૩૪૫૬૭૮૯',\n * '୦୧୨୩୪୫୬୭୮୯',\n * '௦௧௨௩௪௫௬௭௮௯',\n * ].join('\\n');\n *\n * console.log(unicodeDigits.translate(list));\n * ```\n */\n constructor(toLanguage: UnicodeLangKeys, fromLanguages: UnicodeLangKeys[] | 'all' = [...commonLangList]) {\n if (fromLanguages === 'all') {\n fromLanguages = Object.keys(supportedLanguageList) as UnicodeLangKeys[];\n }\n\n const removeSelf = fromLanguages.indexOf(toLanguage);\n if (removeSelf !== -1) fromLanguages.splice(removeSelf, 1);\n\n this._toLangZeroCode = supportedLanguageList[toLanguage];\n\n const regParts: string[] = [];\n for (let n = 0; n < 10; n++) {\n regParts.push('(' + fromLanguages.map((langKey) => String.fromCharCode(supportedLanguageList[langKey] + n)).join('|') + ')');\n }\n this._searchRegExt = new RegExp(regParts.join('|'), 'g');\n this._replacer = this._replacer.bind(this);\n }\n\n /**\n * Convert the String of number of the source language to the destination language.\n *\n * @param {string} str - String of number of the source language.\n * @returns String of number of the destination language.\n *\n * Example:\n *\n * ```ts\n * const list = [\n * '0123456789',\n * '٠١٢٣٤٥٦٧٨٩',\n * '߀߁߂߃߄߅߆߇߈߉',\n * '०१२३४५६७८९',\n * '০১২৩৪৫৬৭৮৯',\n * '੦੧੨੩੪੫੬੭੮੯',\n * '૦૧૨૩૪૫૬૭૮૯',\n * '୦୧୨୩୪୫୬୭୮୯',\n * '௦௧௨௩௪௫௬௭௮௯',\n * ].join('\\n');\n *\n * console.log(unicodeDigits.translate(list));\n * ```\n */\n public translate(str: string): string {\n return str.trim() === '' ? str : str.replace(this._searchRegExt, this._replacer);\n }\n}\n"],
5
- "mappings": ";qqBAAA,2HAAM,sBAAwB,CAC5B,GAAI,GACJ,GAAI,KACJ,GAAI,KACJ,IAAK,KACL,GAAI,KACJ,GAAI,KACJ,GAAI,KACJ,GAAI,KACJ,GAAI,KACJ,GAAI,KACJ,GAAI,KACJ,GAAI,KAEJ,IAAK,KACL,aAAc,KACd,KAAM,KACN,IAAK,KACL,QAAS,KACT,QAAS,KACT,aAAc,KACd,MAAO,KACP,UAAW,KACX,MAAO,KACP,YAAa,KACb,cAAe,KACf,cAAe,KACf,SAAU,KACV,UAAW,KACX,OAAQ,KACR,SAAU,KACV,IAAK,MACL,WAAY,MACZ,SAAU,MACV,SAAU,MACV,kBAAmB,MACnB,KAAM,MACN,aAAc,MACd,UAAW,MACX,QAAS,MACT,OAAQ,MACR,aAAc,MACd,OAAQ,MACR,QAAS,MACT,UAAW,MACX,KAAM,MACN,QAAS,MACT,KAAM,MACN,MAAO,MACP,KAAM,MACN,YAAa,MACb,UAAW,MACX,IAAK,MACL,aAAc,MACd,kBAAmB,OACnB,6BAA8B,OAC9B,0BAA2B,OAC3B,+BAAgC,OAChC,uBAAwB,OACxB,KAAM,MACR,EAIA,IAAM,eAAoC,CAAC,KAAM,KAAM,IAAI,EAEpD,IAAM,cAAN,KAAoB,CAIf,UAAU,KAAc,KAAwB,CACxD,OAAO,OAAO,aAAa,KAAK,gBAAkB,KAAK,UAAW,GAAM,GAAK,IAAI,CAAC,CACpF,CAyBA,YAAY,WAA6B,cAA2C,CAAC,GAAG,cAAc,EAAG,CACvG,GAAI,gBAAkB,MAAO,CAC3B,cAAgB,OAAO,KAAK,qBAAqB,CACnD,CAEA,MAAM,WAAa,cAAc,QAAQ,UAAU,EACnD,GAAI,aAAe,GAAI,cAAc,OAAO,WAAY,CAAC,EAEzD,KAAK,gBAAkB,sBAAsB,UAAU,EAEvD,MAAM,SAAqB,CAAC,EAC5B,QAAS,EAAI,EAAG,EAAI,GAAI,IAAK,CAC3B,SAAS,KAAK,IAAM,cAAc,IAAK,SAAY,OAAO,aAAa,sBAAsB,OAAO,EAAI,CAAC,CAAC,EAAE,KAAK,GAAG,EAAI,GAAG,CAC7H,CACA,KAAK,cAAgB,IAAI,OAAO,SAAS,KAAK,GAAG,EAAG,GAAG,EACvD,KAAK,UAAY,KAAK,UAAU,KAAK,IAAI,CAC3C,CA0BO,UAAU,IAAqB,CACpC,OAAO,IAAI,KAAK,IAAM,GAAK,IAAM,IAAI,QAAQ,KAAK,cAAe,KAAK,SAAS,CACjF,CACF",
6
- "names": []
7
- }
package/dist/main.mjs DELETED
@@ -1,3 +0,0 @@
1
- /** 📦 @alwatr/unicode-digits v5.5.29 */
2
- var supportedLanguageList={en:48,ar:1632,fa:1776,nko:1984,hi:2406,bn:2534,pa:2662,gu:2790,or:2918,ta:3046,te:3174,kn:3302,mal:3430,sinhala_lith:3558,thai:3664,lao:3792,tibetan:3872,myanmar:4160,myanmar_shan:4240,khmer:6112,mongolian:6160,limbu:6470,new_tai_lue:6608,tai_tham_hora:6784,tai_tham_tham:6800,balinese:6992,sundanese:7088,lepcha:7232,ol_chiki:7248,vai:42528,saurashtra:43216,kayah_li:43264,javanese:43472,myanmar_tai_laing:43504,cham:43600,meetei_mayek:44016,fullwidth:65296,osmanya:66720,brahmi:69734,sora_sompeng:69872,chakma:69942,sharada:70096,khudawadi:70384,newa:70736,tirhuta:70864,modi:71248,takri:71360,ahom:71472,warang_citi:71904,bhaiksuki:72784,mro:92768,pahawh_hmong:93008,mathematical_bold:120782,"mathematical_double-struck":120792,"mathematical_sans-serif":120802,"mathematical_sans-serif_bold":120812,mathematical_monospace:120822,fula:125264};var commonLangList=["en","fa","ar"];var UnicodeDigits=class{_replacer(_,...args){return String.fromCharCode(this._toLangZeroCode+args.findIndex(v=>v!=null))}constructor(toLanguage,fromLanguages=[...commonLangList]){if(fromLanguages==="all"){fromLanguages=Object.keys(supportedLanguageList)}const removeSelf=fromLanguages.indexOf(toLanguage);if(removeSelf!==-1)fromLanguages.splice(removeSelf,1);this._toLangZeroCode=supportedLanguageList[toLanguage];const regParts=[];for(let n=0;n<10;n++){regParts.push("("+fromLanguages.map(langKey=>String.fromCharCode(supportedLanguageList[langKey]+n)).join("|")+")")}this._searchRegExt=new RegExp(regParts.join("|"),"g");this._replacer=this._replacer.bind(this)}translate(str){return str.trim()===""?str:str.replace(this._searchRegExt,this._replacer)}};export{UnicodeDigits};
3
- //# sourceMappingURL=main.mjs.map
package/dist/main.mjs.map DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/main.ts"],
4
- "sourcesContent": ["const supportedLanguageList = {\n en: 0x0030,\n ar: 0x0660,\n fa: 0x06f0,\n nko: 0x07c0,\n hi: 0x0966, // devanagari\n bn: 0x09e6, // bengali\n pa: 0x0a66, // gurmukhi, punjabi\n gu: 0x0ae6, // gujarati\n or: 0x0b66, // oriya\n ta: 0x0be6, // tamil\n te: 0x0c66, // telugu\n kn: 0x0ce6, // kannada\n\n mal: 0x0d66, // malayalam\n sinhala_lith: 0x0de6,\n thai: 0x0e50,\n lao: 0x0ed0,\n tibetan: 0x0f20,\n myanmar: 0x1040,\n myanmar_shan: 0x1090,\n khmer: 0x17e0,\n mongolian: 0x1810,\n limbu: 0x1946,\n new_tai_lue: 0x19d0,\n tai_tham_hora: 0x1a80,\n tai_tham_tham: 0x1a90,\n balinese: 0x1b50,\n sundanese: 0x1bb0,\n lepcha: 0x1c40,\n ol_chiki: 0x1c50,\n vai: 0xa620,\n saurashtra: 0xa8d0,\n kayah_li: 0xa900,\n javanese: 0xa9d0,\n myanmar_tai_laing: 0xa9f0,\n cham: 0xaa50,\n meetei_mayek: 0xabf0,\n fullwidth: 0xff10,\n osmanya: 0x104a0,\n brahmi: 0x11066,\n sora_sompeng: 0x110f0,\n chakma: 0x11136,\n sharada: 0x111d0,\n khudawadi: 0x112f0,\n newa: 0x11450,\n tirhuta: 0x114d0,\n modi: 0x11650,\n takri: 0x116c0,\n ahom: 0x11730,\n warang_citi: 0x118e0,\n bhaiksuki: 0x11c50,\n mro: 0x16a60,\n pahawh_hmong: 0x16b50,\n mathematical_bold: 0x1d7ce,\n 'mathematical_double-struck': 0x1d7d8,\n 'mathematical_sans-serif': 0x1d7e2,\n 'mathematical_sans-serif_bold': 0x1d7ec,\n mathematical_monospace: 0x1d7f6,\n fula: 0x1e950, // adlam script in fula lang\n} as const;\n\nexport type UnicodeLangKeys = keyof typeof supportedLanguageList;\n\nconst commonLangList: UnicodeLangKeys[] = ['en', 'fa', 'ar'];\n\nexport class UnicodeDigits {\n protected _toLangZeroCode;\n protected _searchRegExt;\n\n protected _replacer(_: string, ...args: number[]): string {\n return String.fromCharCode(this._toLangZeroCode + args.findIndex((v) => v != null));\n }\n\n /**\n * Translate number.\n *\n * Example:\n *\n * ```ts\n * const unicodeDigits = new UnicodeDigits('en');\n *\n * const list = [\n * '0123456789',\n * '٠١٢٣٤٥٦٧٨٩',\n * '߀߁߂߃߄߅߆߇߈߉',\n * '०१२३४५६७८९',\n * '০১২৩৪৫৬৭৮৯',\n * '੦੧੨੩੪੫੬੭੮੯',\n * '૦૧૨૩૪૫૬૭૮૯',\n * '୦୧୨୩୪୫୬୭୮୯',\n * '௦௧௨௩௪௫௬௭௮௯',\n * ].join('\\n');\n *\n * console.log(unicodeDigits.translate(list));\n * ```\n */\n constructor(toLanguage: UnicodeLangKeys, fromLanguages: UnicodeLangKeys[] | 'all' = [...commonLangList]) {\n if (fromLanguages === 'all') {\n fromLanguages = Object.keys(supportedLanguageList) as UnicodeLangKeys[];\n }\n\n const removeSelf = fromLanguages.indexOf(toLanguage);\n if (removeSelf !== -1) fromLanguages.splice(removeSelf, 1);\n\n this._toLangZeroCode = supportedLanguageList[toLanguage];\n\n const regParts: string[] = [];\n for (let n = 0; n < 10; n++) {\n regParts.push('(' + fromLanguages.map((langKey) => String.fromCharCode(supportedLanguageList[langKey] + n)).join('|') + ')');\n }\n this._searchRegExt = new RegExp(regParts.join('|'), 'g');\n this._replacer = this._replacer.bind(this);\n }\n\n /**\n * Convert the String of number of the source language to the destination language.\n *\n * @param {string} str - String of number of the source language.\n * @returns String of number of the destination language.\n *\n * Example:\n *\n * ```ts\n * const list = [\n * '0123456789',\n * '٠١٢٣٤٥٦٧٨٩',\n * '߀߁߂߃߄߅߆߇߈߉',\n * '०१२३४५६७८९',\n * '০১২৩৪৫৬৭৮৯',\n * '੦੧੨੩੪੫੬੭੮੯',\n * '૦૧૨૩૪૫૬૭૮૯',\n * '୦୧୨୩୪୫୬୭୮୯',\n * '௦௧௨௩௪௫௬௭௮௯',\n * ].join('\\n');\n *\n * console.log(unicodeDigits.translate(list));\n * ```\n */\n public translate(str: string): string {\n return str.trim() === '' ? str : str.replace(this._searchRegExt, this._replacer);\n }\n}\n"],
5
- "mappings": ";AAAA,IAAM,sBAAwB,CAC5B,GAAI,GACJ,GAAI,KACJ,GAAI,KACJ,IAAK,KACL,GAAI,KACJ,GAAI,KACJ,GAAI,KACJ,GAAI,KACJ,GAAI,KACJ,GAAI,KACJ,GAAI,KACJ,GAAI,KAEJ,IAAK,KACL,aAAc,KACd,KAAM,KACN,IAAK,KACL,QAAS,KACT,QAAS,KACT,aAAc,KACd,MAAO,KACP,UAAW,KACX,MAAO,KACP,YAAa,KACb,cAAe,KACf,cAAe,KACf,SAAU,KACV,UAAW,KACX,OAAQ,KACR,SAAU,KACV,IAAK,MACL,WAAY,MACZ,SAAU,MACV,SAAU,MACV,kBAAmB,MACnB,KAAM,MACN,aAAc,MACd,UAAW,MACX,QAAS,MACT,OAAQ,MACR,aAAc,MACd,OAAQ,MACR,QAAS,MACT,UAAW,MACX,KAAM,MACN,QAAS,MACT,KAAM,MACN,MAAO,MACP,KAAM,MACN,YAAa,MACb,UAAW,MACX,IAAK,MACL,aAAc,MACd,kBAAmB,OACnB,6BAA8B,OAC9B,0BAA2B,OAC3B,+BAAgC,OAChC,uBAAwB,OACxB,KAAM,MACR,EAIA,IAAM,eAAoC,CAAC,KAAM,KAAM,IAAI,EAEpD,IAAM,cAAN,KAAoB,CAIf,UAAU,KAAc,KAAwB,CACxD,OAAO,OAAO,aAAa,KAAK,gBAAkB,KAAK,UAAW,GAAM,GAAK,IAAI,CAAC,CACpF,CAyBA,YAAY,WAA6B,cAA2C,CAAC,GAAG,cAAc,EAAG,CACvG,GAAI,gBAAkB,MAAO,CAC3B,cAAgB,OAAO,KAAK,qBAAqB,CACnD,CAEA,MAAM,WAAa,cAAc,QAAQ,UAAU,EACnD,GAAI,aAAe,GAAI,cAAc,OAAO,WAAY,CAAC,EAEzD,KAAK,gBAAkB,sBAAsB,UAAU,EAEvD,MAAM,SAAqB,CAAC,EAC5B,QAAS,EAAI,EAAG,EAAI,GAAI,IAAK,CAC3B,SAAS,KAAK,IAAM,cAAc,IAAK,SAAY,OAAO,aAAa,sBAAsB,OAAO,EAAI,CAAC,CAAC,EAAE,KAAK,GAAG,EAAI,GAAG,CAC7H,CACA,KAAK,cAAgB,IAAI,OAAO,SAAS,KAAK,GAAG,EAAG,GAAG,EACvD,KAAK,UAAY,KAAK,UAAU,KAAK,IAAI,CAC3C,CA0BO,UAAU,IAAqB,CACpC,OAAO,IAAI,KAAK,IAAM,GAAK,IAAM,IAAI,QAAQ,KAAK,cAAe,KAAK,SAAS,CACjF,CACF",
6
- "names": []
7
- }