jsdomain-parser 1.0.7 → 1.0.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.
@@ -1,5 +1,8 @@
1
- var DomainParser = (function (exports) {
2
- 'use strict';
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
3
+ typeof define === 'function' && define.amd ? define(['exports'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.jsDomainParser = {}));
5
+ })(this, (function (exports) { 'use strict';
3
6
 
4
7
  const parseUrl = (url) => {
5
8
  if (!url) throw new Error("Invalid domain name");
@@ -9859,6 +9862,7 @@ var DomainParser = (function (exports) {
9859
9862
  }
9860
9863
  }
9861
9864
 
9865
+ // handle case where hostname is an IP address
9862
9866
  const isIP = /^\d{1,3}(\.\d{1,3}){3}$/.test(hostname);
9863
9867
 
9864
9868
  if (detected.length == 0 && !isIP) {
@@ -9933,7 +9937,7 @@ var DomainParser = (function (exports) {
9933
9937
  url: urlData,
9934
9938
  };
9935
9939
  } catch (e) {
9936
- throw new Error(`Invalid URL: ${e}`);
9940
+ throw new Error(`Invalid URL: ${e.message}`);
9937
9941
  }
9938
9942
  }
9939
9943
 
@@ -9949,6 +9953,4 @@ var DomainParser = (function (exports) {
9949
9953
 
9950
9954
  Object.defineProperty(exports, '__esModule', { value: true });
9951
9955
 
9952
- return exports;
9953
-
9954
- })({});
9956
+ }));