jsdomain-parser 1.0.0 → 1.0.2
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 +2 -2
- package/dist/jsdomain-parser.cjs.js +25 -6
- package/dist/jsdomain-parser.cjs.min.js +1 -1
- package/dist/jsdomain-parser.esm.js +23 -5
- package/dist/jsdomain-parser.esm.min.js +1 -1
- package/dist/jsdomain-parser.js +25 -6
- package/dist/jsdomain-parser.min.js +1 -1
- package/{src/index.js → index.js} +2 -2
- package/package.json +1 -2
- package/rollup.config.js +1 -1
- package/src/parseTld.js +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# JS
|
|
1
|
+
# JS Domain Parser
|
|
2
2
|
|
|
3
|
-
JS
|
|
3
|
+
JS Domain Parser is a lightweight JavaScript library designed to parse and extract detailed information from URLs. It supports detecting TLDs (Top-Level Domains), handling private and unknown TLDs, and extending the TLD list with custom values.
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
@@ -6872,7 +6872,7 @@ var icann = {
|
|
|
6872
6872
|
zone: 1,
|
|
6873
6873
|
zuerich: 1
|
|
6874
6874
|
};
|
|
6875
|
-
var tlds = {
|
|
6875
|
+
var tlds$1 = {
|
|
6876
6876
|
icann: icann,
|
|
6877
6877
|
"private": {
|
|
6878
6878
|
"12chars.dev": 2,
|
|
@@ -9785,6 +9785,18 @@ var tlds = {
|
|
|
9785
9785
|
}
|
|
9786
9786
|
};
|
|
9787
9787
|
|
|
9788
|
+
var tlds$2 = /*#__PURE__*/Object.freeze({
|
|
9789
|
+
__proto__: null,
|
|
9790
|
+
icann: icann,
|
|
9791
|
+
'default': tlds$1
|
|
9792
|
+
});
|
|
9793
|
+
|
|
9794
|
+
function getCjsExportFromNamespace (n) {
|
|
9795
|
+
return n && n['default'] || n;
|
|
9796
|
+
}
|
|
9797
|
+
|
|
9798
|
+
var tlds = getCjsExportFromNamespace(tlds$2);
|
|
9799
|
+
|
|
9788
9800
|
const parseTld = (hostname, options = {}) => {
|
|
9789
9801
|
const {
|
|
9790
9802
|
allowUnknown = false,
|
|
@@ -9836,14 +9848,16 @@ const parseTld = (hostname, options = {}) => {
|
|
|
9836
9848
|
length: detected.length,
|
|
9837
9849
|
parts: detected,
|
|
9838
9850
|
};
|
|
9839
|
-
};
|
|
9851
|
+
};
|
|
9852
|
+
|
|
9853
|
+
var parseTld_1 = parseTld;
|
|
9840
9854
|
|
|
9841
9855
|
function parse(url, options = {}) {
|
|
9842
9856
|
try {
|
|
9843
9857
|
if (!url.startsWith("http")) url = `http://${url}`;
|
|
9844
9858
|
const urlObject = new URL(url);
|
|
9845
9859
|
|
|
9846
|
-
const tldData =
|
|
9860
|
+
const tldData = parseTld_1(urlObject.hostname, options);
|
|
9847
9861
|
|
|
9848
9862
|
let domain = urlObject.hostname;
|
|
9849
9863
|
const hostnameParts = urlObject.hostname.split(".");
|
|
@@ -9879,7 +9893,12 @@ function parse(url, options = {}) {
|
|
|
9879
9893
|
} catch (e) {
|
|
9880
9894
|
throw new Error(`Invalid URL: ${e}`);
|
|
9881
9895
|
}
|
|
9882
|
-
}
|
|
9896
|
+
}
|
|
9897
|
+
|
|
9898
|
+
var jsdomainParser = { parse, parseTld: parseTld_1 };
|
|
9899
|
+
var jsdomainParser_1 = jsdomainParser.parse;
|
|
9900
|
+
var jsdomainParser_2 = jsdomainParser.parseTld;
|
|
9883
9901
|
|
|
9884
|
-
exports
|
|
9885
|
-
exports.
|
|
9902
|
+
exports["default"] = jsdomainParser;
|
|
9903
|
+
exports.parse = jsdomainParser_1;
|
|
9904
|
+
exports.parseTld = jsdomainParser_2;
|