greip.js 2.1.2 → 2.1.4

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.
Files changed (3) hide show
  1. package/README.md +16 -33
  2. package/lib/index.js +29 -29
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -2,13 +2,13 @@
2
2
  <h1>Greip Javascript Library</h1>
3
3
  <p>The official JS library of Greip API</p>
4
4
  <br />
5
- <a href="https://github.com/gre-dev/GeoIP-JS/issues/new">Report Issue</a> ·
6
- <a href="https://github.com/gre-dev/GeoIP-JS/discussions/new">Request Feature</a> ·
5
+ <a href="https://github.com/gre-dev/Greip-JS/issues/new">Report Issue</a> ·
6
+ <a href="https://github.com/gre-dev/Greip-JS/discussions/new">Request Feature</a> ·
7
7
  <a href="https://greip.io" target="_BLANK">Home Page</a> ·
8
- <a href="https://docs.greip.io/sdks/js" target="_BLANK">API Docs</a>
8
+ <a href="https://docs.greip.io/tools-and-libraries/js" target="_BLANK">API Docs</a>
9
9
  <br />
10
10
  <br />
11
- <a href="https://www.npmjs.com/package/gre-geoip" title="NPM Package" href="_BLANK"><img src="https://img.shields.io/badge/npm-CB3837?style=for-the-badge&logo=npm&logoColor=white"></a>
11
+ <a href="https://www.npmjs.com/package/greip.js" title="NPM Package" href="_BLANK"><img src="https://img.shields.io/badge/npm-CB3837?style=for-the-badge&logo=npm&logoColor=white"></a>
12
12
  <a href="https://github.com/gre-dev/Greip-JS" title="Github Repo" href="_BLANK"><img src="https://img.shields.io/badge/GitHub-100000?style=for-the-badge&logo=github&logoColor=white"></a>
13
13
  <a href="https://www.patreon.com/gredev" title="Patreon Profile - GRE Development Ltd." href="_BLANK"><img src="https://img.shields.io/badge/Patreon-ff424e?style=for-the-badge&logo=patreon&logoColor=white"></a>
14
14
  <img src="https://img.shields.io/badge/JavaScript-323330?style=for-the-badge&logo=javascript&logoColor=F7DF1E" title="Javascript">
@@ -18,9 +18,9 @@
18
18
  ---
19
19
  <br />
20
20
 
21
- [![npm version](https://badge.fury.io/js/gre-geoip.svg)](https://badge.fury.io/js/gre-geoip)
21
+ [![npm version](https://badge.fury.io/js/greip.js.svg)](https://badge.fury.io/js/greip.js)
22
22
  &nbsp;&nbsp;
23
- ![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/gre-dev/GeoIP-JS?color=green&label=Minified%20size&logo=github)
23
+ ![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/gre-dev/Greip-JS?color=green&label=Minified%20size&logo=github)
24
24
  &nbsp;&nbsp;
25
25
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
26
26
  &nbsp;&nbsp;
@@ -34,17 +34,11 @@ No requirements for using this package.
34
34
  # Installation
35
35
  For Node.js, React.js & React Native:
36
36
  ```
37
- npm i gre-geoip --save
37
+ npm i greip.js --save
38
38
  ```
39
39
  or
40
40
  ```
41
- yarn add gre-geoip
42
- ```
43
- <br />
44
-
45
- For Browser:
46
- ```html
47
- <script src="https://cdn.jsdelivr.net/gh/gre-dev/GeoIP-JS@latest/gre-geoip.min.js"></script>
41
+ yarn add greip.js
48
42
  ```
49
43
  <br /><br />
50
44
 
@@ -54,35 +48,24 @@ Let's say that we want to get the visitor IP Address. So we do the following:
54
48
 
55
49
  For Node.js, React.js & React Native:
56
50
  ```javascript
57
- const GREGeoIP = require('gre-geoip');
58
- const GeoIP = new GREGeoIP('<API-Key>');
51
+ import { GeoIP } from 'greip.js';
59
52
 
60
- GeoIP.geoip({}).then(res => {
61
- console.log(res?.data?.ip);
53
+ await GeoIP({
54
+ key: 'your-api-key',
55
+ }).then((res: any) => {
56
+ console.log(res.data); // Log Response
62
57
  });
63
58
  ```
64
- <br />
65
-
66
- For Browser:
67
- ```html
68
- <script>
69
- const GeoIP = new GREGeoIP('<API-Key>');
70
-
71
- GeoIP.geoip({}).then(res => {
72
- console.log(res?.data?.ip);
73
- });
74
- </script>
75
- ```
76
59
 
77
60
  <br /><br />
78
61
  # Options, Methods and More
79
- You can find the full guide of this package by visiting our [Documentation Page](https://geoip-docs.gredev.io/sdks/js).
62
+ You can find the full guide of this package by visiting our [Documentation Page](https://docs.greip.io/tools-and-libraries/js).
80
63
 
81
64
  <br /><br />
82
65
  # Credits
83
- * [GRE Development Ltd.](https://www.gredev.io/en/)
66
+ * [Greip Developers](https://greip.io)
84
67
  * [All Contributors](https://github.com/gre-dev/Greip-JS/graphs/contributors)
85
68
 
86
69
  <br /><br />
87
70
  # License
88
- The MIT License (MIT). Please see [License](https://github.com/gre-dev/GeoIP-JS/blob/main/LICENSE) File for more information.
71
+ The MIT License (MIT). Please see [License](https://github.com/gre-dev/Greip-JS/blob/main/LICENSE) File for more information.
package/lib/index.js CHANGED
@@ -43,11 +43,11 @@ var GeoIP = function (options) {
43
43
  '" you specified is unknown.\nYou can use: `live` or `test`.\nRead more at: https://geoip-docs.gredev.io/sdks/js/geoip-method#options'));
44
44
  }
45
45
  (0, util_1.makeHttpRquest)('GeoIP', {
46
- "key": options.key,
47
- "params": params.join(','),
48
- "format": format,
49
- "lang": lang,
50
- "mode": mode,
46
+ 'key': options.key,
47
+ 'params': params.join(','),
48
+ 'format': format,
49
+ 'lang': lang,
50
+ 'mode': mode,
51
51
  }, function (res) {
52
52
  if (typeof res !== 'object')
53
53
  res = JSON.parse(res);
@@ -102,12 +102,12 @@ var Lookup = function (options) {
102
102
  '" you specified is unknown.\nYou can use: `live` or `test`.\nRead more at: https://geoip-docs.gredev.io/sdks/js/lookup-method#options'));
103
103
  }
104
104
  (0, util_1.makeHttpRquest)('IPLookup', {
105
- "ip": ip,
106
- "key": options.key,
107
- "params": params.join(','),
108
- "format": format,
109
- "lang": lang,
110
- "mode": mode,
105
+ 'ip': ip,
106
+ 'key': options.key,
107
+ 'params': params.join(','),
108
+ 'format': format,
109
+ 'lang': lang,
110
+ 'mode': mode,
111
111
  }, function (res) {
112
112
  if (typeof res !== 'object')
113
113
  res = JSON.parse(res);
@@ -169,12 +169,12 @@ var BulkLookup = function (options) {
169
169
  '" you specified is unknown.\nYou can use: `live` or `test`.\nRead more at: https://geoip-docs.gredev.io/sdks/js/lookup-method#options'));
170
170
  }
171
171
  (0, util_1.makeHttpRquest)('BulkLookup', {
172
- "ips": ips,
173
- "key": options.key,
174
- "params": params.join(','),
175
- "format": format,
176
- "lang": lang,
177
- "mode": mode,
172
+ 'ips': ips,
173
+ 'key': options.key,
174
+ 'params': params.join(','),
175
+ 'format': format,
176
+ 'lang': lang,
177
+ 'mode': mode,
178
178
  }, function (res) {
179
179
  if (typeof res !== 'object')
180
180
  res = JSON.parse(res);
@@ -230,12 +230,12 @@ var Country = function (options) {
230
230
  '" you specified is unknown.\nYou can use: `live` or `test`.\nRead more at: https://geoip-docs.gredev.io/sdks/js/country-method#options'));
231
231
  }
232
232
  (0, util_1.makeHttpRquest)('Country', {
233
- "CountryCode": countryCode,
234
- "key": options.key,
235
- "params": params.join(','),
236
- "format": format,
237
- "lang": lang,
238
- "mode": mode,
233
+ 'CountryCode': countryCode,
234
+ 'key': options.key,
235
+ 'params': params.join(','),
236
+ 'format': format,
237
+ 'lang': lang,
238
+ 'mode': mode,
239
239
  }, function (res) {
240
240
  if (typeof res !== 'object')
241
241
  res = JSON.parse(res);
@@ -280,12 +280,12 @@ var BadWord = function (options) {
280
280
  '" you specified is unknown.\nYou can use: `live` or `test`.\nRead more at: https://geoip-docs.gredev.io/sdks/js/country-method#options'));
281
281
  }
282
282
  (0, util_1.makeHttpRquest)('badWords', {
283
- "text": text,
284
- "key": options.key,
285
- "params": params.join(','),
286
- "format": format,
287
- "lang": lang,
288
- "mode": mode,
283
+ 'text': text,
284
+ 'key': options.key,
285
+ 'params': params.join(','),
286
+ 'format': format,
287
+ 'lang': lang,
288
+ 'mode': mode,
289
289
  }, function (res) {
290
290
  if (typeof res !== 'object')
291
291
  res = JSON.parse(res);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "greip.js",
3
- "version": "2.1.2",
3
+ "version": "2.1.4",
4
4
  "description": "The official JS library of Greip.",
5
5
  "author": {
6
6
  "name": "GRE Development Ltd.",
@@ -31,7 +31,7 @@
31
31
  "scripts": {
32
32
  "test": "jest --config jestconfig.json",
33
33
  "build": "tsc",
34
- "format": "prettier --write \"src/**/*.ts\" \"src/**/*.js\"",
34
+ "format": "prettier --write \"src/**/*.ts\"",
35
35
  "lint": "tslint -p tsconfig.json",
36
36
  "prepare": "npm run build",
37
37
  "prepublishOnly": "npm test && npm run lint",