unprint 0.9.4 → 0.9.6
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/package.json +1 -1
- package/src/app.js +11 -2
package/package.json
CHANGED
package/src/app.js
CHANGED
|
@@ -193,11 +193,11 @@ const defaultNumberRegexp = /\d+(\.\d+)?/;
|
|
|
193
193
|
|
|
194
194
|
function matchNumberString(numberString, options) {
|
|
195
195
|
if (numberString && options.match) {
|
|
196
|
-
return Number(numberString.match(options.match)?.[options.matchIndex]);
|
|
196
|
+
return Number(numberString.match(options.match)?.[options.matchIndex]) || null;
|
|
197
197
|
}
|
|
198
198
|
|
|
199
199
|
if (numberString) {
|
|
200
|
-
return Number(numberString);
|
|
200
|
+
return Number(numberString) || null;
|
|
201
201
|
}
|
|
202
202
|
|
|
203
203
|
return null;
|
|
@@ -535,6 +535,14 @@ function queryDates(context, selector, format, customOptions) {
|
|
|
535
535
|
}));
|
|
536
536
|
}
|
|
537
537
|
|
|
538
|
+
function formatDate(dateValue, format, inputFormat) {
|
|
539
|
+
if (inputFormat) {
|
|
540
|
+
return moment(dateValue, inputFormat).format(format);
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
return moment(dateValue).format(format);
|
|
544
|
+
}
|
|
545
|
+
|
|
538
546
|
function extractDuration(durationString, match) {
|
|
539
547
|
const durationMatch = durationString?.match(match || /(\d+:)?\d+:\d+/);
|
|
540
548
|
|
|
@@ -799,6 +807,7 @@ module.exports = {
|
|
|
799
807
|
extractDate,
|
|
800
808
|
extractDuration,
|
|
801
809
|
extractTimestamp,
|
|
810
|
+
formatDate,
|
|
802
811
|
prefixUrl,
|
|
803
812
|
options: configure,
|
|
804
813
|
query: initQueryFns(queryFns),
|