unprint 0.18.16 → 0.18.18
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 +5 -32
package/package.json
CHANGED
package/src/app.js
CHANGED
|
@@ -376,41 +376,14 @@ function prefixUrl(urlPath, originUrl, customOptions) {
|
|
|
376
376
|
|
|
377
377
|
const origin = originUrl?.replace(/^.*?:/, `${options.protocol}:`);
|
|
378
378
|
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
function getQueryUrlArgs(selectorOrOptions, customOptions) {
|
|
384
|
-
if (customOptions) {
|
|
385
|
-
return {
|
|
386
|
-
selector: selectorOrOptions,
|
|
387
|
-
customOptions,
|
|
388
|
-
};
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
if (typeof selectorOrOptions === 'string') {
|
|
392
|
-
return {
|
|
393
|
-
selector: selectorOrOptions,
|
|
394
|
-
customOptions: null,
|
|
395
|
-
};
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
if (!selectorOrOptions) {
|
|
399
|
-
return {
|
|
400
|
-
selector: 'a',
|
|
401
|
-
customOptions: null,
|
|
402
|
-
};
|
|
379
|
+
try {
|
|
380
|
+
return new URL(urlPath, origin).href;
|
|
381
|
+
} catch {
|
|
382
|
+
return null;
|
|
403
383
|
}
|
|
404
|
-
|
|
405
|
-
return {
|
|
406
|
-
selector: 'a',
|
|
407
|
-
customOptions: selectorOrOptions,
|
|
408
|
-
};
|
|
409
384
|
}
|
|
410
385
|
|
|
411
|
-
function queryUrl(context,
|
|
412
|
-
const { selector, customOptions } = getQueryUrlArgs(...args);
|
|
413
|
-
|
|
386
|
+
function queryUrl(context, selector = 'a', customOptions) {
|
|
414
387
|
const options = {
|
|
415
388
|
...context.options,
|
|
416
389
|
attribute: 'href',
|