greip.js 2.1.1 → 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.
- package/README.md +16 -33
- package/lib/index.js +29 -29
- package/package.json +7 -7
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/
|
|
6
|
-
<a href="https://github.com/gre-dev/
|
|
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/
|
|
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/
|
|
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
|
-
[](https://badge.fury.io/js/greip.js)
|
|
22
22
|
|
|
23
|
-

|
|
24
24
|
|
|
25
25
|
[](https://opensource.org/licenses/MIT)
|
|
26
26
|
|
|
@@ -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
|
|
37
|
+
npm i greip.js --save
|
|
38
38
|
```
|
|
39
39
|
or
|
|
40
40
|
```
|
|
41
|
-
yarn add
|
|
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
|
-
|
|
58
|
-
const GeoIP = new GREGeoIP('<API-Key>');
|
|
51
|
+
import { GeoIP } from 'greip.js';
|
|
59
52
|
|
|
60
|
-
GeoIP
|
|
61
|
-
|
|
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://
|
|
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
|
-
* [
|
|
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/
|
|
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
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
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
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
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
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
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
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
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.
|
|
3
|
+
"version": "2.1.4",
|
|
4
4
|
"description": "The official JS library of Greip.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "GRE Development Ltd.",
|
|
@@ -31,13 +31,13 @@
|
|
|
31
31
|
"scripts": {
|
|
32
32
|
"test": "jest --config jestconfig.json",
|
|
33
33
|
"build": "tsc",
|
|
34
|
-
"format": "prettier --write \"src/**/*.ts\"
|
|
34
|
+
"format": "prettier --write \"src/**/*.ts\"",
|
|
35
35
|
"lint": "tslint -p tsconfig.json",
|
|
36
|
-
"prepare"
|
|
37
|
-
"prepublishOnly"
|
|
38
|
-
"preversion"
|
|
39
|
-
"version"
|
|
40
|
-
"postversion"
|
|
36
|
+
"prepare": "npm run build",
|
|
37
|
+
"prepublishOnly": "npm test && npm run lint",
|
|
38
|
+
"preversion": "npm run lint",
|
|
39
|
+
"version": "npm run format && git add -A src",
|
|
40
|
+
"postversion": "git push && git push --tags"
|
|
41
41
|
},
|
|
42
42
|
"repository": {
|
|
43
43
|
"type": "git",
|