unprint 0.11.12 → 0.11.13

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/app.js +14 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unprint",
3
- "version": "0.11.12",
3
+ "version": "0.11.13",
4
4
  "description": "Simplify common web scraping tasks while staying in control of the data.",
5
5
  "main": "src/app.js",
6
6
  "scripts": {
package/src/app.js CHANGED
@@ -217,11 +217,23 @@ function extractNumber(rawNumberString, customOptions) {
217
217
  : rawNumberString.replace(',', '');
218
218
 
219
219
  if (numberString && options.match) {
220
- return Number(numberString.match(options.match)?.[options.matchIndex]) || null;
220
+ const number = Number(numberString.match(options.match)?.[options.matchIndex]);
221
+
222
+ if (Number.isNaN(number)) {
223
+ return null;
224
+ }
225
+
226
+ return number;
221
227
  }
222
228
 
223
229
  if (numberString) {
224
- return Number(numberString) || null;
230
+ const number = Number(numberString);
231
+
232
+ if (Number.isNaN(number)) {
233
+ return null;
234
+ }
235
+
236
+ return number;
225
237
  }
226
238
 
227
239
  return null;