@storyteller-platform/align 0.1.10 → 0.1.11

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.
@@ -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
- return (0, import_to_words.toWords)(number, {
71
- localeCode: `${maximizedLocale.language}-${maximizedLocale.region}`,
72
- currency: true,
73
- doNotAddOnly: true
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
- return (0, import_to_words.toWords)(number, {
107
- localeCode: `${maximizedLocale.language}-${maximizedLocale.region}`
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],
@@ -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
- return toWords(number, {
49
- localeCode: `${maximizedLocale.language}-${maximizedLocale.region}`,
50
- currency: true,
51
- doNotAddOnly: true
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
- return toWords(number, {
85
- localeCode: `${maximizedLocale.language}-${maximizedLocale.region}`
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storyteller-platform/align",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "description": "A library and CLI for automatically aligning audiobooks and EPUBs to produce Media Overlays",
5
5
  "author": "Shane Friedman",
6
6
  "license": "MIT",