@alwatr/unicode-digits 5.5.30 → 6.0.1

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.1 */
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=0D7CAAD04064182264756E2164756E21
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": "0D7CAAD04064182264756E2164756E21",
9
+ "names": []
10
+ }
package/package.json CHANGED
@@ -1,30 +1,57 @@
1
1
  {
2
2
  "name": "@alwatr/unicode-digits",
3
+ "version": "6.0.1",
3
4
  "description": "Convert the String of number of the source language to the destination language.",
4
- "version": "5.5.30",
5
+ "license": "MPL-2.0",
5
6
  "author": "S. Ali Mihandoost <ali.mihandoost@gmail.com>",
6
- "bugs": "https://github.com/Alwatr/nanolib/issues",
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",
12
- "typescript": "^5.9.3"
7
+ "type": "module",
8
+ "repository": {
9
+ "directory": "packages/unicode-digits",
10
+ "type": "git",
11
+ "url": "https://github.com/Alwatr/nanolib"
13
12
  },
13
+ "homepage": "https://github.com/Alwatr/nanolib/tree/next/packages/unicode-digits#readme",
14
+ "bugs": "https://github.com/Alwatr/nanolib/issues",
14
15
  "exports": {
15
16
  ".": {
16
17
  "types": "./dist/main.d.ts",
17
- "import": "./dist/main.mjs",
18
- "require": "./dist/main.cjs"
18
+ "default": "./dist/main.js"
19
19
  }
20
20
  },
21
+ "sideEffects": false,
22
+ "devDependencies": {
23
+ "@alwatr/nano-build": "7.0.1",
24
+ "@alwatr/prettier-config": "7.0.1",
25
+ "@alwatr/tsconfig-base": "8.0.0",
26
+ "@alwatr/type-helper": "8.0.1",
27
+ "typescript": "^5.9.3"
28
+ },
29
+ "scripts": {
30
+ "b": "bun run build",
31
+ "build": "bun run build:ts && bun run build:es",
32
+ "build:es": "nano-build --preset=module src/main.ts",
33
+ "build:ts": "tsc --build",
34
+ "c": "bun run clean",
35
+ "cb": "bun run clean && bun run build",
36
+ "clean": "rm -rfv dist *.tsbuildinfo",
37
+ "d": "bun run build:es && bun",
38
+ "t": "bun run test",
39
+ "test": "bun test",
40
+ "w": "bun run watch",
41
+ "watch": "bun run watch:ts & bun run watch:es",
42
+ "watch:es": "bun run build:es --watch",
43
+ "watch:ts": "bun run build:ts --watch --preserveWatchOutput"
44
+ },
21
45
  "files": [
22
- "**/*.{js,mjs,cjs,map,d.ts,html,md,LEGAL.txt}",
46
+ "**/*.{js,mjs,cjs,ts,map,d.ts,html,LEGAL.txt}",
47
+ "README.md",
23
48
  "LICENSE",
24
49
  "!demo/**/*",
25
50
  "!**/*.test.js"
26
51
  ],
27
- "homepage": "https://github.com/Alwatr/nanolib/tree/next/packages/unicode-digits#readme",
52
+ "publishConfig": {
53
+ "access": "public"
54
+ },
28
55
  "keywords": [
29
56
  "alwatr",
30
57
  "browser",
@@ -42,36 +69,6 @@
42
69
  "utility",
43
70
  "utils"
44
71
  ],
45
- "license": "MPL-2.0",
46
- "main": "./dist/main.cjs",
47
- "module": "./dist/main.mjs",
48
72
  "prettier": "@alwatr/prettier-config",
49
- "publishConfig": {
50
- "access": "public"
51
- },
52
- "repository": {
53
- "type": "git",
54
- "url": "https://github.com/Alwatr/nanolib",
55
- "directory": "packages/unicode-digits"
56
- },
57
- "scripts": {
58
- "b": "bun run build",
59
- "build": "bun run build:ts && bun run build:es",
60
- "build:es": "nano-build --preset=module",
61
- "build:ts": "tsc --build",
62
- "c": "bun run clean",
63
- "cb": "bun run clean && bun run build",
64
- "clean": "rm -rfv dist *.tsbuildinfo",
65
- "d": "bun run build:es && bun --enable-source-maps --trace-warnings",
66
- "t": "bun run test",
67
- "test": "bun test",
68
- "w": "bun run watch",
69
- "watch": "bun run watch:ts & bun run watch:es",
70
- "watch:es": "bun run build:es --watch",
71
- "watch:ts": "bun run build:ts --watch --preserveWatchOutput"
72
- },
73
- "sideEffects": false,
74
- "type": "module",
75
- "types": "./dist/main.d.ts",
76
- "gitHead": "def1decf8f496f4b0d3d3ab952c346c689c30160"
73
+ "gitHead": "f843742e94d6ebed3921d57b624d9deb35c2c102"
77
74
  }
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,253 +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.30](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@5.5.29...@alwatr/unicode-digits@5.5.30) (2026-03-18)
7
-
8
- **Note:** Version bump only for package @alwatr/unicode-digits
9
-
10
- ## [5.5.29](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@5.5.28...@alwatr/unicode-digits@5.5.29) (2026-03-16)
11
-
12
- ### 🔨 Code Refactoring
13
-
14
- * migrate build scripts from yarn to bun across multiple packages ([d90e962](https://github.com/Alwatr/nanolib/commit/d90e962f15e5c951e191d5f02341279b6472abc3))
15
-
16
- ## [5.5.28](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@5.5.27...@alwatr/unicode-digits@5.5.28) (2026-02-18)
17
-
18
- **Note:** Version bump only for package @alwatr/unicode-digits
19
-
20
- ## [5.5.27](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@5.5.26...@alwatr/unicode-digits@5.5.27) (2025-12-23)
21
-
22
- **Note:** Version bump only for package @alwatr/unicode-digits
23
-
24
- ## [5.5.26](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@5.5.25...@alwatr/unicode-digits@5.5.26) (2025-12-13)
25
-
26
- **Note:** Version bump only for package @alwatr/unicode-digits
27
-
28
- ## [5.5.25](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@5.5.24...@alwatr/unicode-digits@5.5.25) (2025-12-10)
29
-
30
- **Note:** Version bump only for package @alwatr/unicode-digits
31
-
32
- ## [5.5.24](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@5.5.23...@alwatr/unicode-digits@5.5.24) (2025-11-18)
33
-
34
- ### 🔨 Code Refactoring
35
-
36
- * remove unnecessary type declarations from tsconfig.json files ([89bcc7d](https://github.com/Alwatr/nanolib/commit/89bcc7db839807110b80f8ba34414ea9734d9c75))
37
-
38
- ## [5.5.23](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@5.5.22...@alwatr/unicode-digits@5.5.23) (2025-11-15)
39
-
40
- **Note:** Version bump only for package @alwatr/unicode-digits
41
-
42
- ## [5.5.22](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@5.5.21...@alwatr/unicode-digits@5.5.22) (2025-11-15)
43
-
44
- **Note:** Version bump only for package @alwatr/unicode-digits
45
-
46
- ## [5.5.21](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@5.5.20...@alwatr/unicode-digits@5.5.21) (2025-11-04)
47
-
48
- **Note:** Version bump only for package @alwatr/unicode-digits
49
-
50
- ## [5.5.20](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@5.5.19...@alwatr/unicode-digits@5.5.20) (2025-10-06)
51
-
52
- ### 🔗 Dependencies update
53
-
54
- * bump the npm-dependencies group with 4 updates ([9825815](https://github.com/Alwatr/nanolib/commit/982581552bbb4b97dca52af5e93a80937f0c3109))
55
-
56
- ## [5.5.19](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@5.5.18...@alwatr/unicode-digits@5.5.19) (2025-09-27)
57
-
58
- ### 🧹 Miscellaneous Chores
59
-
60
- * exclude test files from package distribution ([86f4f2f](https://github.com/Alwatr/nanolib/commit/86f4f2f5985845c5cf3a3a9398de7b2f98ce53e7))
61
-
62
- ## [5.5.18](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@5.5.17...@alwatr/unicode-digits@5.5.18) (2025-09-22)
63
-
64
- **Note:** Version bump only for package @alwatr/unicode-digits
65
-
66
- ## [5.5.17](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@5.5.16...@alwatr/unicode-digits@5.5.17) (2025-09-22)
67
-
68
- **Note:** Version bump only for package @alwatr/unicode-digits
69
-
70
- ## [5.5.16](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@5.5.15...@alwatr/unicode-digits@5.5.16) (2025-09-21)
71
-
72
- **Note:** Version bump only for package @alwatr/unicode-digits
73
-
74
- ## [5.5.15](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@5.5.14...@alwatr/unicode-digits@5.5.15) (2025-09-20)
75
-
76
- ### 🐛 Bug Fixes
77
-
78
- * add sideEffects property to package.json files for better tree-shaking ([c7b9e74](https://github.com/Alwatr/nanolib/commit/c7b9e74e1920c8e35b438742de61883ca62da58c))
79
- * add sideEffects property to package.json files for better tree-shaking ([e8402c4](https://github.com/Alwatr/nanolib/commit/e8402c481a14a1f807a37aaa862a936713d26176))
80
-
81
- ### 🧹 Miscellaneous Chores
82
-
83
- * remove duplicate sideEffects property from multiple package.json files ([b123f86](https://github.com/Alwatr/nanolib/commit/b123f86be81481de2314aae9bb2eeb629743d24c))
84
-
85
- ## [5.5.14](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@5.5.13...@alwatr/unicode-digits@5.5.14) (2025-09-19)
86
-
87
- **Note:** Version bump only for package @alwatr/unicode-digits
88
-
89
- ## [5.5.13](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@5.5.12...@alwatr/unicode-digits@5.5.13) (2025-09-15)
90
-
91
- **Note:** Version bump only for package @alwatr/unicode-digits
92
-
93
- ## [5.5.12](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@5.5.11...@alwatr/unicode-digits@5.5.12) (2025-09-13)
94
-
95
- **Note:** Version bump only for package @alwatr/unicode-digits
96
-
97
- ## [5.5.11](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@5.5.10...@alwatr/unicode-digits@5.5.11) (2025-09-13)
98
-
99
- ### 🧹 Miscellaneous Chores
100
-
101
- * remove package-tracer dependency and related code from fetch package ([96fe4e9](https://github.com/Alwatr/nanolib/commit/96fe4e9552a205f218ceed187c55e4e904a07089))
102
-
103
- ## [5.5.10](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@5.5.9...@alwatr/unicode-digits@5.5.10) (2025-09-09)
104
-
105
- ### 🧹 Miscellaneous Chores
106
-
107
- * remove trailing newlines from contributing sections in README files ([e8ab1bc](https://github.com/Alwatr/nanolib/commit/e8ab1bc43e0addea5ccd4c897c2cec597cb9e15f))
108
-
109
- ## [5.5.9](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@5.5.8...@alwatr/unicode-digits@5.5.9) (2025-09-06)
110
-
111
- **Note:** Version bump only for package @alwatr/unicode-digits
112
-
113
- ## [5.5.8](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@5.5.7...@alwatr/unicode-digits@5.5.8) (2025-09-05)
114
-
115
- **Note:** Version bump only for package @alwatr/unicode-digits
116
-
117
- ## [5.5.7](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@5.5.6...@alwatr/unicode-digits@5.5.7) (2025-09-01)
118
-
119
- **Note:** Version bump only for package @alwatr/unicode-digits
120
-
121
- ## [5.5.6](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@5.5.5...@alwatr/unicode-digits@5.5.6) (2025-08-23)
122
-
123
- **Note:** Version bump only for package @alwatr/unicode-digits
124
-
125
- ## [5.5.5](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@5.5.3...@alwatr/unicode-digits@5.5.5) (2025-08-23)
126
-
127
- ### 🐛 Bug Fixes
128
-
129
- * update license from AGPL-3.0-only to MPL-2.0 ([d20968e](https://github.com/Alwatr/nanolib/commit/d20968e60cc89b1dcdf9b96507178da6ed562f55))
130
- * update package versions in multiple package.json files ([7638b1c](https://github.com/Alwatr/nanolib/commit/7638b1cafee2b4e0f97db7a89ac9fba6384b9b10))
131
-
132
- ### 🔨 Code Refactoring
133
-
134
- * 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))
135
-
136
- ### 🧹 Miscellaneous Chores
137
-
138
- * reformat all package.json files ([ceda45d](https://github.com/Alwatr/nanolib/commit/ceda45de186667790474f729cb4b161a5148ce19))
139
-
140
- ### 🔗 Dependencies update
141
-
142
- * update TypeScript and Jest versions across all packages to improve compatibility and performance ([31baf36](https://github.com/Alwatr/nanolib/commit/31baf366101e92e27db66a21c849fb101f19be47))
143
-
144
- ## [5.5.4](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@5.5.3...@alwatr/unicode-digits@5.5.4) (2025-08-23)
145
-
146
- ### Code Refactoring
147
-
148
- * 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
149
-
150
- ## <small>5.5.3 (2025-04-15)</small>
151
-
152
- **Note:** Version bump only for package @alwatr/unicode-digits
153
-
154
- ## [5.5.2](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@5.5.1...@alwatr/unicode-digits@5.5.2) (2025-04-01)
155
-
156
- **Note:** Version bump only for package @alwatr/unicode-digits
157
-
158
- ## [5.5.1](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@5.5.0...@alwatr/unicode-digits@5.5.1) (2025-03-18)
159
-
160
- **Note:** Version bump only for package @alwatr/unicode-digits
161
-
162
- ## [5.5.0](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@5.4.0...@alwatr/unicode-digits@5.5.0) (2025-03-06)
163
-
164
- ### Miscellaneous Chores
165
-
166
- * update username casing in changelog entries ([9722ac9](https://github.com/Alwatr/nanolib/commit/9722ac9a078438a4e8ebfa5826ea70e0e3a52ca6)) by @
167
-
168
- ### Dependencies update
169
-
170
- * bump the development-dependencies group across 1 directory with 11 updates ([720c395](https://github.com/Alwatr/nanolib/commit/720c3954da55c929fe8fb16957121f4c51fb7f0c)) by @dependabot[bot]
171
-
172
- ## [5.4.0](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@1.1.3...@alwatr/unicode-digits@5.4.0) (2025-02-18)
173
-
174
- ## 5.3.0 (2025-02-03)
175
-
176
- ### Miscellaneous Chores
177
-
178
- * edit README ([3860b3d](https://github.com/Alwatr/nanolib/commit/3860b3df48ab82dc479d5236c2e8579df614aabf)) by @
179
-
180
- ### Dependencies update
181
-
182
- * bump the development-dependencies group across 1 directory with 11 updates ([cb79d07](https://github.com/Alwatr/nanolib/commit/cb79d072a57c79e1c01abff1a293d6757bb65350)) by @
183
- * 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 @
184
-
185
- ## 5.0.0 (2024-11-02)
186
-
187
- ### ⚠ BREAKING CHANGES
188
-
189
- * 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.
190
-
191
- ### Code Refactoring
192
-
193
- * use the same version as @alwatr/nanolib ([60eb860](https://github.com/Alwatr/nanolib/commit/60eb860a0e33dfffe2d1d95e63ce54c60876be06)) by @
194
-
195
- ## [5.3.0](https://github.com/Alwatr/nanolib/compare/v5.2.1...v5.3.0) (2025-02-03)
196
-
197
- ### Miscellaneous Chores
198
-
199
- * edit README ([3860b3d](https://github.com/Alwatr/nanolib/commit/3860b3df48ab82dc479d5236c2e8579df614aabf)) by @ArmanAsadian
200
-
201
- ### Dependencies update
202
-
203
- * bump the development-dependencies group across 1 directory with 11 updates ([cb79d07](https://github.com/Alwatr/nanolib/commit/cb79d072a57c79e1c01abff1a293d6757bb65350)) by @dependabot[bot]
204
- * 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
205
-
206
- ## 5.0.0 (2024-11-02)
207
-
208
- ### ⚠ BREAKING CHANGES
209
-
210
- * 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.
211
-
212
- ### Features
213
-
214
- * **unicode-digits:** add `unicode-digits` package ([2ee138e](https://github.com/Alwatr/nanolib/commit/2ee138e5532c44ad186a340d18fc2a22c619259c)) by @
215
- * **unicode-digits:** use `packageTracer` ([425e3f9](https://github.com/Alwatr/nanolib/commit/425e3f920b5d82dad8a4db283201dfefd370e4de)) by @
216
-
217
- ### Code Refactoring
218
-
219
- * use the same version as @alwatr/nanolib ([60eb860](https://github.com/Alwatr/nanolib/commit/60eb860a0e33dfffe2d1d95e63ce54c60876be06)) by @
220
-
221
- ### Miscellaneous Chores
222
-
223
- * include LICENSE and LEGAL files to publish ([09f366f](https://github.com/Alwatr/nanolib/commit/09f366f680bfa9fb26acb2cd1ccbc68c5a9e9ad8)) by @
224
-
225
- ## [1.1.3](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@1.1.2...@alwatr/unicode-digits@1.1.3) (2024-11-02)
226
-
227
- **Note:** Version bump only for package @alwatr/unicode-digits
228
-
229
- ## [1.1.2](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@1.1.1...@alwatr/unicode-digits@1.1.2) (2024-10-25)
230
-
231
- **Note:** Version bump only for package @alwatr/unicode-digits
232
-
233
- ## [1.1.1](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@1.1.0...@alwatr/unicode-digits@1.1.1) (2024-10-12)
234
-
235
- **Note:** Version bump only for package @alwatr/unicode-digits
236
-
237
- ## [1.1.0](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@1.0.1...@alwatr/unicode-digits@1.1.0) (2024-10-11)
238
-
239
- ### Features
240
-
241
- - **unicode-digits:** use `packageTracer` ([425e3f9](https://github.com/Alwatr/nanolib/commit/425e3f920b5d82dad8a4db283201dfefd370e4de)) by @mohammadhonarvar
242
-
243
- ## [1.0.1](https://github.com/Alwatr/nanolib/compare/@alwatr/unicode-digits@1.0.0...@alwatr/unicode-digits@1.0.1) (2024-10-11)
244
-
245
- ### Miscellaneous Chores
246
-
247
- - include LICENSE and LEGAL files to publish ([09f366f](https://github.com/Alwatr/nanolib/commit/09f366f680bfa9fb26acb2cd1ccbc68c5a9e9ad8)) by @alimd
248
-
249
- ## 1.0.0 (2024-10-11)
250
-
251
- ### Features
252
-
253
- - **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.30 */
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.30 */
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
- }