@kyco-utils/number 0.1.0 → 0.1.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/README.md +7 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/README.md
ADDED
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;AASO,IAAM,mBAAA,GAAsB,CAAC,MAAA,KAAyC;AAE3E,EAAA,MAAM,QAAQ,IAAI,IAAA,CAAK,aAAa,MAAM,CAAA,CAAE,cAAc,OAAO,CAAA;AACjE,EAAA,MAAM,kBAAA,GAAqB,MAAM,IAAA,CAAK,CAAC,SAAS,IAAA,CAAK,IAAA,KAAS,OAAO,CAAA,EAAG,KAAA,IAAS,GAAA;AACjF,EAAA,MAAM,gBAAA,GAAmB,MAAM,IAAA,CAAK,CAAC,SAAS,IAAA,CAAK,IAAA,KAAS,SAAS,CAAA,EAAG,KAAA,IAAS,GAAA;AACjF,EAAA,OAAO,EAAE,oBAAoB,gBAAA,EAAiB;AAChD","file":"index.cjs","sourcesContent":["import type { UserLocale } from '@kyco-utils/enums'\nimport type { NumberSeparators } from '@kyco-utils/types'\n\n/**\n * Gets the thousands and decimal separators for a given locale\n *\n * @param locale - The locale to get separators for\n * @returns Object containing `thousandsSeparator` and `decimalSeparator`\n */\nexport const getNumberSeparators = (locale: UserLocale): NumberSeparators => {\n // @locale-updates\n const parts = new Intl.NumberFormat(locale).formatToParts(11111.1)\n const thousandsSeparator = parts.find((part) => part.type === 'group')?.value ?? ','\n const decimalSeparator = parts.find((part) => part.type === 'decimal')?.value ?? '.'\n return { thousandsSeparator, decimalSeparator }\n}\n"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { UserLocale } from '@kyco-utils/enums';
|
|
2
2
|
import { NumberSeparators } from '@kyco-utils/types';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Gets the thousands and decimal separators for a given locale
|
|
6
|
+
*
|
|
7
|
+
* @param locale - The locale to get separators for
|
|
8
|
+
* @returns Object containing `thousandsSeparator` and `decimalSeparator`
|
|
9
|
+
*/
|
|
4
10
|
declare const getNumberSeparators: (locale: UserLocale) => NumberSeparators;
|
|
5
11
|
|
|
6
12
|
export { getNumberSeparators };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { UserLocale } from '@kyco-utils/enums';
|
|
2
2
|
import { NumberSeparators } from '@kyco-utils/types';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Gets the thousands and decimal separators for a given locale
|
|
6
|
+
*
|
|
7
|
+
* @param locale - The locale to get separators for
|
|
8
|
+
* @returns Object containing `thousandsSeparator` and `decimalSeparator`
|
|
9
|
+
*/
|
|
4
10
|
declare const getNumberSeparators: (locale: UserLocale) => NumberSeparators;
|
|
5
11
|
|
|
6
12
|
export { getNumberSeparators };
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";AASO,IAAM,mBAAA,GAAsB,CAAC,MAAA,KAAyC;AAE3E,EAAA,MAAM,QAAQ,IAAI,IAAA,CAAK,aAAa,MAAM,CAAA,CAAE,cAAc,OAAO,CAAA;AACjE,EAAA,MAAM,kBAAA,GAAqB,MAAM,IAAA,CAAK,CAAC,SAAS,IAAA,CAAK,IAAA,KAAS,OAAO,CAAA,EAAG,KAAA,IAAS,GAAA;AACjF,EAAA,MAAM,gBAAA,GAAmB,MAAM,IAAA,CAAK,CAAC,SAAS,IAAA,CAAK,IAAA,KAAS,SAAS,CAAA,EAAG,KAAA,IAAS,GAAA;AACjF,EAAA,OAAO,EAAE,oBAAoB,gBAAA,EAAiB;AAChD","file":"index.js","sourcesContent":["import type { UserLocale } from '@kyco-utils/enums'\nimport type { NumberSeparators } from '@kyco-utils/types'\n\n/**\n * Gets the thousands and decimal separators for a given locale\n *\n * @param locale - The locale to get separators for\n * @returns Object containing `thousandsSeparator` and `decimalSeparator`\n */\nexport const getNumberSeparators = (locale: UserLocale): NumberSeparators => {\n // @locale-updates\n const parts = new Intl.NumberFormat(locale).formatToParts(11111.1)\n const thousandsSeparator = parts.find((part) => part.type === 'group')?.value ?? ','\n const decimalSeparator = parts.find((part) => part.type === 'decimal')?.value ?? '.'\n return { thousandsSeparator, decimalSeparator }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kyco-utils/number",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Locale-aware number utilities for kyco-utils.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"module": "./dist/index.js",
|
|
26
26
|
"types": "./dist/index.d.ts",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@kyco-utils/enums": "^0.1.
|
|
29
|
-
"@kyco-utils/types": "^0.1.
|
|
28
|
+
"@kyco-utils/enums": "^0.1.1",
|
|
29
|
+
"@kyco-utils/types": "^0.1.1"
|
|
30
30
|
},
|
|
31
31
|
"publishConfig": {
|
|
32
32
|
"access": "public",
|