global-tld-list 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/CHANGELOG.md +4 -0
- package/package.json +1 -1
- package/test1.js +0 -6
- package/test2.js +0 -39
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### 1.0.2 (2023-06-21)
|
|
6
|
+
|
|
7
|
+
### 1.0.1 (2023-06-20)
|
|
8
|
+
|
|
5
9
|
## [1.0.0](https://github.com/mastermunj/global-tld-list/compare/v0.0.1139...v1.0.0) (2023-06-19)
|
|
6
10
|
|
|
7
11
|
|
package/package.json
CHANGED
package/test1.js
DELETED
package/test2.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
const { TLDs } = require('./dist/index');
|
|
2
|
-
|
|
3
|
-
const tldMap = new Map();
|
|
4
|
-
for (const tld of TLDs) {
|
|
5
|
-
tldMap.set(tld, 1);
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
function replacer(key, value) {
|
|
9
|
-
if (value instanceof Map) {
|
|
10
|
-
return {
|
|
11
|
-
dataType: 'Map',
|
|
12
|
-
value: Array.from(value.entries()), // or with spread: value: [...value]
|
|
13
|
-
};
|
|
14
|
-
} else {
|
|
15
|
-
return value;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function reviver(key, value) {
|
|
20
|
-
if (typeof value === 'object' && value !== null) {
|
|
21
|
-
if (value.dataType === 'Map') {
|
|
22
|
-
return new Map(value.value);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
return value;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
console.log(tldMap.size);
|
|
29
|
-
const serialized = JSON.stringify(tldMap, replacer);
|
|
30
|
-
const newMap = JSON.parse(serialized, reviver);
|
|
31
|
-
|
|
32
|
-
// const serialized = JSON.stringify([...tldMap]);
|
|
33
|
-
// const newMap = new Map(JSON.parse(serialized));
|
|
34
|
-
|
|
35
|
-
console.log(serialized);
|
|
36
|
-
|
|
37
|
-
console.log(newMap.size);
|
|
38
|
-
// console.log(newMap);
|
|
39
|
-
console.log(newMap.has('com'));
|