@storyteller-platform/align 0.1.10 → 0.1.12
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/align/slugify.cjs +16 -8
- package/dist/align/slugify.js +16 -8
- package/package.json +1 -1
package/dist/align/slugify.cjs
CHANGED
|
@@ -67,11 +67,15 @@ function createReplacers(locale) {
|
|
|
67
67
|
const normalizedNumeral = numeralMatch.replaceAll(new RegExp(`\\${currencySymbols.group}`, "g"), "").replace(new RegExp(`\\${currencySymbols.decimal}`), ".");
|
|
68
68
|
const number = parseFloat(normalizedNumeral);
|
|
69
69
|
if (Number.isNaN(number)) return match[0];
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
70
|
+
try {
|
|
71
|
+
return (0, import_to_words.toWords)(number, {
|
|
72
|
+
localeCode: `${maximizedLocale.language}-${maximizedLocale.region}`,
|
|
73
|
+
currency: true,
|
|
74
|
+
doNotAddOnly: true
|
|
75
|
+
});
|
|
76
|
+
} catch {
|
|
77
|
+
return match[0];
|
|
78
|
+
}
|
|
75
79
|
}
|
|
76
80
|
const numberFormat = new Intl.NumberFormat(locale);
|
|
77
81
|
const numberParts = numberFormat.formatToParts(demoNumber);
|
|
@@ -103,9 +107,13 @@ function createReplacers(locale) {
|
|
|
103
107
|
const normalizedNumeral = numeralMatch.replaceAll(new RegExp(`\\${numberSymbols.group}`, "g"), "").replace(new RegExp(`\\${numberSymbols.decimal}`), ".");
|
|
104
108
|
const number = parseFloat(normalizedNumeral);
|
|
105
109
|
if (Number.isNaN(number)) return match[0];
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
110
|
+
try {
|
|
111
|
+
return (0, import_to_words.toWords)(number, {
|
|
112
|
+
localeCode: `${maximizedLocale.language}-${maximizedLocale.region}`
|
|
113
|
+
});
|
|
114
|
+
} catch {
|
|
115
|
+
return match[0];
|
|
116
|
+
}
|
|
109
117
|
}
|
|
110
118
|
return [
|
|
111
119
|
[currencyRegex, currencyReplacer],
|
package/dist/align/slugify.js
CHANGED
|
@@ -45,11 +45,15 @@ function createReplacers(locale) {
|
|
|
45
45
|
const normalizedNumeral = numeralMatch.replaceAll(new RegExp(`\\${currencySymbols.group}`, "g"), "").replace(new RegExp(`\\${currencySymbols.decimal}`), ".");
|
|
46
46
|
const number = parseFloat(normalizedNumeral);
|
|
47
47
|
if (Number.isNaN(number)) return match[0];
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
48
|
+
try {
|
|
49
|
+
return toWords(number, {
|
|
50
|
+
localeCode: `${maximizedLocale.language}-${maximizedLocale.region}`,
|
|
51
|
+
currency: true,
|
|
52
|
+
doNotAddOnly: true
|
|
53
|
+
});
|
|
54
|
+
} catch {
|
|
55
|
+
return match[0];
|
|
56
|
+
}
|
|
53
57
|
}
|
|
54
58
|
const numberFormat = new Intl.NumberFormat(locale);
|
|
55
59
|
const numberParts = numberFormat.formatToParts(demoNumber);
|
|
@@ -81,9 +85,13 @@ function createReplacers(locale) {
|
|
|
81
85
|
const normalizedNumeral = numeralMatch.replaceAll(new RegExp(`\\${numberSymbols.group}`, "g"), "").replace(new RegExp(`\\${numberSymbols.decimal}`), ".");
|
|
82
86
|
const number = parseFloat(normalizedNumeral);
|
|
83
87
|
if (Number.isNaN(number)) return match[0];
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
88
|
+
try {
|
|
89
|
+
return toWords(number, {
|
|
90
|
+
localeCode: `${maximizedLocale.language}-${maximizedLocale.region}`
|
|
91
|
+
});
|
|
92
|
+
} catch {
|
|
93
|
+
return match[0];
|
|
94
|
+
}
|
|
87
95
|
}
|
|
88
96
|
return [
|
|
89
97
|
[currencyRegex, currencyReplacer],
|
package/package.json
CHANGED