@k03mad/ip2geo 7.1.0 → 7.2.0

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/.husky/pre-commit CHANGED
@@ -1,2 +1 @@
1
- npm run lint
2
- npm run test
1
+ ./node_modules/.bin/run-p -c lint test
package/app/lib/ip2geo.js CHANGED
@@ -67,7 +67,11 @@ export const ip2geo = async ({
67
67
  rps = DEFAULT_RPS,
68
68
  } = {}) => {
69
69
  if (ip) {
70
- const mapCache = readFromMapCache(ip, cacheMap, cacheMapMaxEntries);
70
+ const mapCache = readFromMapCache(
71
+ ip,
72
+ cacheMap,
73
+ cacheMapMaxEntries,
74
+ );
71
75
 
72
76
  if (mapCache) {
73
77
  return mapCache;
@@ -75,12 +79,19 @@ export const ip2geo = async ({
75
79
 
76
80
  const fsCache = await readFromFsCache(
77
81
  ip,
78
- cacheDir, cacheFileName,
79
- cacheFileSeparator, cacheFileNewline,
82
+ cacheDir,
83
+ cacheFileName,
84
+ cacheFileSeparator,
85
+ cacheFileNewline,
80
86
  );
81
87
 
82
88
  if (fsCache) {
83
- writeToMapCache(fsCache, cacheMap, cacheMapMaxEntries);
89
+ writeToMapCache(
90
+ fsCache,
91
+ cacheMap,
92
+ cacheMapMaxEntries,
93
+ );
94
+
84
95
  return fsCache;
85
96
  }
86
97
  }
@@ -112,12 +123,19 @@ export const ip2geo = async ({
112
123
  body?.connection?.domain,
113
124
  ]);
114
125
 
115
- writeToMapCache(outputData, cacheMap, cacheMapMaxEntries);
126
+ writeToMapCache(
127
+ outputData,
128
+ cacheMap,
129
+ cacheMapMaxEntries,
130
+ );
116
131
 
117
132
  await writeToFsCache(
118
- body.ip, outputData,
119
- cacheDir, cacheFileName,
120
- cacheFileSeparator, cacheFileNewline,
133
+ body.ip,
134
+ outputData,
135
+ cacheDir,
136
+ cacheFileName,
137
+ cacheFileSeparator,
138
+ cacheFileNewline,
121
139
  );
122
140
 
123
141
  return outputData;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@k03mad/ip2geo",
3
- "version": "7.1.0",
3
+ "version": "7.2.0",
4
4
  "description": "GeoIP library",
5
5
  "maintainers": [
6
6
  "Kirill Molchanov <k03.mad@gmail.com"
@@ -19,24 +19,23 @@
19
19
  "node": ">=20"
20
20
  },
21
21
  "dependencies": {
22
- "@k03mad/request": "5.6.4",
23
- "@k03mad/simple-log": "2.1.3",
22
+ "@k03mad/request": "5.7.0",
23
+ "@k03mad/simple-log": "2.1.4",
24
24
  "chalk": "5.3.0",
25
- "debug": "4.3.4"
25
+ "debug": "4.3.5"
26
26
  },
27
27
  "devDependencies": {
28
- "@k03mad/eslint-config": "20.7.0",
28
+ "@k03mad/eslint-config": "22.1.0",
29
29
  "eslint": "8.57.0",
30
30
  "husky": "9.0.11",
31
- "mocha": "10.4.0"
31
+ "mocha": "10.4.0",
32
+ "npm-run-all": "4.1.5"
32
33
  },
33
34
  "scripts": {
34
35
  "lint": "npm run lint:eslint",
35
36
  "lint:eslint": "eslint ./ --cache",
36
37
  "test": "rm -rfv ./.geoip && mocha tests",
37
- "clean": "npm run clean:modules && npm run clean:eslint:cache",
38
- "clean:modules": "rm -rf ./node_modules || true",
39
- "clean:eslint:cache": "rm -rf .eslintcache || true",
38
+ "clean": "rm -rf ./node_modules .eslintcache || true",
40
39
  "setup": "npm run clean && npm run setup:pnpm",
41
40
  "setup:pnpm": "npm i pnpm -g && pnpm i",
42
41
  "prepare": "husky || true"
package/tests/default.js CHANGED
@@ -38,7 +38,7 @@ describe(testName, () => {
38
38
 
39
39
  Object.keys(REQUEST_IPV4).forEach(key => {
40
40
  it(`should have "${key}" in request response`, () => {
41
- assert.ok(data[key]);
41
+ assert.ok(Object.hasOwn(data, key));
42
42
  });
43
43
  });
44
44
 
@@ -25,8 +25,8 @@ export const REQUEST_IPV4_MAP_OFF_ONLY = {
25
25
  regionCode: 'ZH',
26
26
  city: 'Zürich',
27
27
  connectionAsn: 19_281,
28
- connectionOrg: 'Quad9',
29
- connectionIsp: 'Quad9',
28
+ connectionOrg: 'Quad',
29
+ connectionIsp: 'Quad',
30
30
  connectionDomain: 'quad9.net',
31
31
  };
32
32
 
@@ -40,8 +40,8 @@ export const REQUEST_IPV6 = {
40
40
  region: 'North Holland',
41
41
  regionCode: 'NH',
42
42
  city: 'Amsterdam',
43
- connectionAsn: 0,
44
- connectionOrg: '',
45
- connectionIsp: 'NetActuate Inc',
43
+ connectionAsn: 36_236,
44
+ connectionOrg: 'Netactuate INC',
45
+ connectionIsp: 'Netactuate, INC',
46
46
  connectionDomain: '',
47
47
  };