unprint 0.11.3 → 0.11.4

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 +6 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unprint",
3
- "version": "0.11.3",
3
+ "version": "0.11.4",
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
@@ -317,17 +317,11 @@ function prefixUrl(urlPath, originUrl, customOptions) {
317
317
  return null;
318
318
  }
319
319
 
320
- if (!originUrl) {
321
- return urlPath;
322
- }
323
-
324
320
  const options = {
325
321
  protocol: 'https',
326
322
  ...customOptions,
327
323
  };
328
324
 
329
- const { origin, protocol } = new URL(originUrl);
330
-
331
325
  if (/^http/.test(urlPath)) {
332
326
  // this is already a complete URL
333
327
  return urlPath;
@@ -337,6 +331,12 @@ function prefixUrl(urlPath, originUrl, customOptions) {
337
331
  return `${options.protocol.replace(/:$/, '')}:${urlPath}`; // allow protocol to be defined either as 'https' or 'https:'
338
332
  }
339
333
 
334
+ if (!originUrl) {
335
+ return urlPath;
336
+ }
337
+
338
+ const { origin, protocol } = new URL(originUrl);
339
+
340
340
  if (protocol && /^\/\//.test(urlPath)) {
341
341
  return `${protocol}${urlPath}`;
342
342
  }