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.
- package/README.md +6 -2
- package/dist/jsdomain-parser.cjs.js +2 -1
- package/dist/jsdomain-parser.cjs.min.js +1 -1
- package/dist/jsdomain-parser.esm.js +2 -1
- package/dist/jsdomain-parser.esm.min.js +1 -1
- package/dist/{jsdomain-parser.js → jsdomain-parser.umd.js} +8 -6
- package/dist/jsdomain-parser.umd.min.js +1 -0
- package/example/example.html +3 -3
- package/package.json +1 -1
- package/rollup.config.js +7 -7
- package/dist/jsdomain-parser.min.js +0 -1
package/README.md
CHANGED
|
@@ -16,12 +16,16 @@ JS Domain Parser is a lightweight JavaScript library designed to parse and extra
|
|
|
16
16
|
npm install jsdomain-parser
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
or you can include `jsdomain-parser` directly in your project by adding the following `<script>` tag to your HTML file:
|
|
20
22
|
|
|
21
23
|
```html
|
|
22
|
-
<script src="./dist/jsdomain-parser.min.js"></script>
|
|
24
|
+
<script src="./dist/jsdomain-parser.umd.min.js"></script>
|
|
23
25
|
```
|
|
24
26
|
|
|
27
|
+
This will expose the `jsDomainParser` global object in the browser.
|
|
28
|
+
|
|
25
29
|
## Usage
|
|
26
30
|
|
|
27
31
|
### Example 1: Basic Parsing
|
|
@@ -9860,6 +9860,7 @@ const parseTld = (url, options = {}) => {
|
|
|
9860
9860
|
}
|
|
9861
9861
|
}
|
|
9862
9862
|
|
|
9863
|
+
// handle case where hostname is an IP address
|
|
9863
9864
|
const isIP = /^\d{1,3}(\.\d{1,3}){3}$/.test(hostname);
|
|
9864
9865
|
|
|
9865
9866
|
if (detected.length == 0 && !isIP) {
|
|
@@ -9934,7 +9935,7 @@ function parse(url, options = {}) {
|
|
|
9934
9935
|
url: urlData,
|
|
9935
9936
|
};
|
|
9936
9937
|
} catch (e) {
|
|
9937
|
-
throw new Error(`Invalid URL: ${e}`);
|
|
9938
|
+
throw new Error(`Invalid URL: ${e.message}`);
|
|
9938
9939
|
}
|
|
9939
9940
|
}
|
|
9940
9941
|
|