unprint 0.17.7 → 0.17.8
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 +19 -4
package/package.json
CHANGED
package/src/app.js
CHANGED
|
@@ -191,12 +191,18 @@ function queryContents(context, selector, customOptions) {
|
|
|
191
191
|
const options = {
|
|
192
192
|
...context.options,
|
|
193
193
|
trim: true,
|
|
194
|
+
filter: true,
|
|
194
195
|
...customOptions,
|
|
195
196
|
};
|
|
196
197
|
|
|
197
198
|
const targets = queryElements(context, selector, options);
|
|
199
|
+
const extractedContents = targets.map((target) => extractContent(target, options));
|
|
200
|
+
|
|
201
|
+
if (options.filter) {
|
|
202
|
+
return extractedContents.filter(Boolean);
|
|
203
|
+
}
|
|
198
204
|
|
|
199
|
-
return
|
|
205
|
+
return extractedContents;
|
|
200
206
|
}
|
|
201
207
|
|
|
202
208
|
function queryAttribute(context, selector, attribute, customOptions) {
|
|
@@ -277,15 +283,24 @@ function queryNumber(context, selector, customOptions) {
|
|
|
277
283
|
}
|
|
278
284
|
|
|
279
285
|
function queryNumbers(context, selector, customOptions) {
|
|
286
|
+
const options = {
|
|
287
|
+
filter: true,
|
|
288
|
+
...customOptions,
|
|
289
|
+
};
|
|
290
|
+
|
|
280
291
|
const numberStrings = queryContents(context, selector, customOptions);
|
|
281
292
|
|
|
282
293
|
if (!numberStrings) {
|
|
283
294
|
return null;
|
|
284
295
|
}
|
|
285
296
|
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
297
|
+
const extractedNumbers = numberStrings.map((numberString) => extractNumber(numberString, customOptions));
|
|
298
|
+
|
|
299
|
+
if (options.filter) {
|
|
300
|
+
return extractedNumbers.filter(Boolean);
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
return extractedNumbers;
|
|
289
304
|
}
|
|
290
305
|
|
|
291
306
|
function queryHtml(context, selector, customOptions) {
|