ac-geoip 3.0.3 → 3.0.5

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 CHANGED
@@ -1,3 +1,23 @@
1
+ <a name="3.0.5"></a>
2
+
3
+ ## [3.0.5](https://github.com/admiralcloud/ac-geoip/compare/v3.0.4..v3.0.5) (2024-07-06 19:11:20)
4
+
5
+
6
+ ### Bug Fix
7
+
8
+ * **App:** Package updates | MP | [1d1ff940a9f3bbee4e063092ef5db2f60d47792e](https://github.com/admiralcloud/ac-geoip/commit/1d1ff940a9f3bbee4e063092ef5db2f60d47792e)
9
+ Package updates
10
+ Related issues: [undefined/undefined#master](undefined/browse/master)
11
+ <a name="3.0.4"></a>
12
+
13
+ ## [3.0.4](https://github.com/admiralcloud/ac-geoip/compare/v3.0.3..v3.0.4) (2024-07-06 18:54:03)
14
+
15
+
16
+ ### Bug Fix
17
+
18
+ * **App:** Replaced isPrivateIP with isSpecialIP | MP | [9a93369cef3549c1b5ac48636f4669fac0332374](https://github.com/admiralcloud/ac-geoip/commit/9a93369cef3549c1b5ac48636f4669fac0332374)
19
+ Replaced isPrivateIP with isSpecialIP
20
+ Related issues: [undefined/undefined#master](undefined/browse/master)
1
21
  <a name="3.0.3"></a>
2
22
 
3
23
  ## [3.0.3](https://github.com/admiralcloud/ac-geoip/compare/v3.0.2..v3.0.3) (2024-07-06 12:44:21)
@@ -0,0 +1,32 @@
1
+ const globals = require('globals')
2
+
3
+ module.exports = {
4
+ ignores: [
5
+ 'config/env/**'
6
+ ],
7
+ languageOptions: {
8
+ ecmaVersion: 2022,
9
+ sourceType: 'module',
10
+ globals: {
11
+ ...globals.commonjs,
12
+ ...globals.es2015,
13
+ ...globals.node,
14
+ expect: 'readonly',
15
+ describe: 'readonly',
16
+ it: 'readonly'
17
+ }
18
+ },
19
+ rules: {
20
+ 'no-const-assign': 'error', // Ensure this rule is enabled
21
+ 'space-before-function-paren': 'off',
22
+ 'no-extra-semi': 'off',
23
+ 'object-curly-spacing': ['error', 'always'],
24
+ 'brace-style': ['error', 'stroustrup', { allowSingleLine: true }],
25
+ 'no-useless-escape': 'off',
26
+ 'standard/no-callback-literal': 'off',
27
+ 'new-cap': 'off',
28
+ 'no-console': ['error', { allow: ['log', 'warn', 'error'] }],
29
+ "no-unused-vars": "error", // we shouldn't clutter code with unused variables
30
+ "prefer-const": ["warn", { "ignoreReadBeforeAssign": true }],
31
+ }
32
+ }
package/index.js CHANGED
@@ -9,7 +9,7 @@ const NodeCache = require("node-cache")
9
9
 
10
10
  const acgeoip = () => {
11
11
 
12
- let geoip = {
12
+ const geoip = {
13
13
  userId: 'userId',
14
14
  licenseKey: 'licenseKey',
15
15
  environment: 'development',
@@ -64,7 +64,7 @@ const acgeoip = () => {
64
64
  }
65
65
 
66
66
  const ip = _.get(params, 'ip')
67
- if (ipPackage.isPrivateIP(ip)) return
67
+ if (ipPackage.isSpecialIP(ip)) return
68
68
 
69
69
  const mapping = _.get(params, 'mapping', geoip.mapping)
70
70
  const debug = _.get(params, 'debug')
@@ -155,7 +155,7 @@ const acgeoip = () => {
155
155
  throw Error(message)
156
156
  }
157
157
  const ip = _.get(params, 'ip')
158
- if (ipPackage.isPrivateIP(ip)) {
158
+ if (ipPackage.isSpecialIP(ip)) {
159
159
  return
160
160
  }
161
161
 
package/package.json CHANGED
@@ -3,10 +3,10 @@
3
3
  "author": "Mark Poepping (https://www.admiralcloud.com)",
4
4
  "license": "MIT",
5
5
  "repository": "admiralcloud/ac-geoip",
6
- "version": "3.0.3",
6
+ "version": "3.0.5",
7
7
  "dependencies": {
8
8
  "@maxmind/geoip2-node": "^5.0.0",
9
- "ac-ip": "^4.0.0",
9
+ "ac-ip": "^4.1.1",
10
10
  "lodash": "^4.17.21",
11
11
  "node-cache": "^5.1.2"
12
12
  },
package/test/test.js CHANGED
@@ -108,9 +108,9 @@ describe('Test Geolite2 local database', () => {
108
108
  it('Shoud be tested with async/await', async function() {
109
109
  this.timeout(5000)
110
110
  const result = await acgeoip.lookupLocal({ ip, debug: false, refresh: true })
111
- let fields = ['iso2', 'city', 'region']
111
+ const fields = ['iso2', 'city', 'region']
112
112
  _.forEach(fields, key => {
113
- let val = _.get(expectedValue, key)
113
+ const val = _.get(expectedValue, key)
114
114
  expect(result).to.have.property(key, val)
115
115
  })
116
116
  expect(result).to.have.property('origin', 'db')
@@ -120,9 +120,9 @@ describe('Test Geolite2 local database', () => {
120
120
  it('Test again - should be from cache', async function() {
121
121
  this.timeout(5000)
122
122
  const result = await acgeoip.lookupLocal({ ip, debug: false })
123
- let fields = ['iso2', 'city', 'region']
123
+ const fields = ['iso2', 'city', 'region']
124
124
  _.forEach(fields, key => {
125
- let val = _.get(expectedValue, key)
125
+ const val = _.get(expectedValue, key)
126
126
  expect(result).to.have.property(key, val)
127
127
  })
128
128
  expect(result).to.have.property('origin', 'db')
package/.eslintrc.js DELETED
@@ -1,27 +0,0 @@
1
- const config = {
2
- root: true,
3
- 'env': {
4
- 'commonjs': true,
5
- 'es6': true,
6
- 'node': true
7
- },
8
- 'extends': 'eslint:recommended',
9
- "rules": {
10
- "space-before-function-paren": 0,
11
- "no-extra-semi": 0,
12
- "object-curly-spacing": ["error", "always"],
13
- "brace-style": ["error", "stroustrup", { "allowSingleLine": true }],
14
- "no-useless-escape": 0,
15
- "standard/no-callback-literal": 0,
16
- "new-cap": 0
17
- },
18
- globals: {
19
- describe: true,
20
- it: true
21
- },
22
- 'parserOptions': {
23
- 'ecmaVersion': 2018
24
- },
25
- }
26
-
27
- module.exports = config