use-mmdb-vanilla 1.0.1 → 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/README.md +6 -219
- package/dist/index.cjs.js +3 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.es.js +66 -63
- package/dist/index.es.js.map +1 -1
- package/dist/index.iife.js +3 -3
- package/dist/index.iife.js.map +1 -1
- package/dist/index.umd.js +3 -3
- package/dist/index.umd.js.map +1 -1
- package/package.json +5 -2
package/dist/index.d.ts
CHANGED
package/dist/index.es.js
CHANGED
|
@@ -49,10 +49,10 @@ function Qt(u) {
|
|
|
49
49
|
var ct = {};
|
|
50
50
|
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
51
51
|
ct.read = function(u, o, s, f, l) {
|
|
52
|
-
var d, p, c = l * 8 - f - 1, g = (1 << c) - 1, m = g >> 1, E = -7,
|
|
53
|
-
for (
|
|
52
|
+
var d, p, c = l * 8 - f - 1, g = (1 << c) - 1, m = g >> 1, E = -7, x = s ? l - 1 : 0, w = s ? -1 : 1, y = u[o + x];
|
|
53
|
+
for (x += w, d = y & (1 << -E) - 1, y >>= -E, E += c; E > 0; d = d * 256 + u[o + x], x += w, E -= 8)
|
|
54
54
|
;
|
|
55
|
-
for (p = d & (1 << -E) - 1, d >>= -E, E += f; E > 0; p = p * 256 + u[o +
|
|
55
|
+
for (p = d & (1 << -E) - 1, d >>= -E, E += f; E > 0; p = p * 256 + u[o + x], x += w, E -= 8)
|
|
56
56
|
;
|
|
57
57
|
if (d === 0)
|
|
58
58
|
d = 1 - m;
|
|
@@ -64,8 +64,8 @@ ct.read = function(u, o, s, f, l) {
|
|
|
64
64
|
return (y ? -1 : 1) * p * Math.pow(2, d - f);
|
|
65
65
|
};
|
|
66
66
|
ct.write = function(u, o, s, f, l, d) {
|
|
67
|
-
var p, c, g, m = d * 8 - l - 1, E = (1 << m) - 1,
|
|
68
|
-
for (o = Math.abs(o), isNaN(o) || o === 1 / 0 ? (c = isNaN(o) ? 1 : 0, p = E) : (p = Math.floor(Math.log(o) / Math.LN2), o * (g = Math.pow(2, -p)) < 1 && (p--, g *= 2), p +
|
|
67
|
+
var p, c, g, m = d * 8 - l - 1, E = (1 << m) - 1, x = E >> 1, w = l === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, y = f ? 0 : d - 1, _ = f ? 1 : -1, S = o < 0 || o === 0 && 1 / o < 0 ? 1 : 0;
|
|
68
|
+
for (o = Math.abs(o), isNaN(o) || o === 1 / 0 ? (c = isNaN(o) ? 1 : 0, p = E) : (p = Math.floor(Math.log(o) / Math.LN2), o * (g = Math.pow(2, -p)) < 1 && (p--, g *= 2), p + x >= 1 ? o += w / g : o += w * Math.pow(2, 1 - x), o * g >= 2 && (p++, g /= 2), p + x >= E ? (c = 0, p = E) : p + x >= 1 ? (c = (o * g - 1) * Math.pow(2, l), p = p + x) : (c = o * Math.pow(2, x - 1) * Math.pow(2, l), p = 0)); l >= 8; u[s + y] = c & 255, y += _, c /= 256, l -= 8)
|
|
69
69
|
;
|
|
70
70
|
for (p = p << l | c, m += l; m > 0; u[s + y] = p & 255, y += _, p /= 256, m -= 8)
|
|
71
71
|
;
|
|
@@ -119,7 +119,7 @@ ct.write = function(u, o, s, f, l, d) {
|
|
|
119
119
|
throw new TypeError(
|
|
120
120
|
'The "string" argument must be of type string. Received type number'
|
|
121
121
|
);
|
|
122
|
-
return
|
|
122
|
+
return x(e);
|
|
123
123
|
}
|
|
124
124
|
return g(e, t, r);
|
|
125
125
|
}
|
|
@@ -166,13 +166,13 @@ ct.write = function(u, o, s, f, l, d) {
|
|
|
166
166
|
c.alloc = function(e, t, r) {
|
|
167
167
|
return E(e, t, r);
|
|
168
168
|
};
|
|
169
|
-
function
|
|
169
|
+
function x(e) {
|
|
170
170
|
return m(e), p(e < 0 ? 0 : T(e) | 0);
|
|
171
171
|
}
|
|
172
172
|
c.allocUnsafe = function(e) {
|
|
173
|
-
return
|
|
173
|
+
return x(e);
|
|
174
174
|
}, c.allocUnsafeSlow = function(e) {
|
|
175
|
-
return
|
|
175
|
+
return x(e);
|
|
176
176
|
};
|
|
177
177
|
function w(e, t) {
|
|
178
178
|
if ((typeof t != "string" || t === "") && (t = "utf8"), !c.isEncoding(t))
|
|
@@ -400,14 +400,14 @@ ct.write = function(u, o, s, f, l, d) {
|
|
|
400
400
|
return 1;
|
|
401
401
|
if (r >>>= 0, n >>>= 0, i >>>= 0, a >>>= 0, this === t)
|
|
402
402
|
return 0;
|
|
403
|
-
let h = a - i,
|
|
404
|
-
const A = Math.min(h,
|
|
403
|
+
let h = a - i, B = n - r;
|
|
404
|
+
const A = Math.min(h, B), F = this.slice(i, a), U = t.slice(r, n);
|
|
405
405
|
for (let I = 0; I < A; ++I)
|
|
406
406
|
if (F[I] !== U[I]) {
|
|
407
|
-
h = F[I],
|
|
407
|
+
h = F[I], B = U[I];
|
|
408
408
|
break;
|
|
409
409
|
}
|
|
410
|
-
return h <
|
|
410
|
+
return h < B ? -1 : B < h ? 1 : 0;
|
|
411
411
|
};
|
|
412
412
|
function ht(e, t, r, n, i) {
|
|
413
413
|
if (e.length === 0)
|
|
@@ -428,11 +428,11 @@ ct.write = function(u, o, s, f, l, d) {
|
|
|
428
428
|
throw new TypeError("val must be string, number or Buffer");
|
|
429
429
|
}
|
|
430
430
|
function ft(e, t, r, n, i) {
|
|
431
|
-
let a = 1, h = e.length,
|
|
431
|
+
let a = 1, h = e.length, B = t.length;
|
|
432
432
|
if (n !== void 0 && (n = String(n).toLowerCase(), n === "ucs2" || n === "ucs-2" || n === "utf16le" || n === "utf-16le")) {
|
|
433
433
|
if (e.length < 2 || t.length < 2)
|
|
434
434
|
return -1;
|
|
435
|
-
a = 2, h /= 2,
|
|
435
|
+
a = 2, h /= 2, B /= 2, r /= 2;
|
|
436
436
|
}
|
|
437
437
|
function A(U, I) {
|
|
438
438
|
return a === 1 ? U[I] : U.readUInt16BE(I * a);
|
|
@@ -442,14 +442,14 @@ ct.write = function(u, o, s, f, l, d) {
|
|
|
442
442
|
let U = -1;
|
|
443
443
|
for (F = r; F < h; F++)
|
|
444
444
|
if (A(e, F) === A(t, U === -1 ? 0 : F - U)) {
|
|
445
|
-
if (U === -1 && (U = F), F - U + 1 ===
|
|
445
|
+
if (U === -1 && (U = F), F - U + 1 === B)
|
|
446
446
|
return U * a;
|
|
447
447
|
} else
|
|
448
448
|
U !== -1 && (F -= F - U), U = -1;
|
|
449
449
|
} else
|
|
450
|
-
for (r +
|
|
450
|
+
for (r + B > h && (r = h - B), F = r; F >= 0; F--) {
|
|
451
451
|
let U = !0;
|
|
452
|
-
for (let I = 0; I <
|
|
452
|
+
for (let I = 0; I < B; I++)
|
|
453
453
|
if (A(e, F + I) !== A(t, I)) {
|
|
454
454
|
U = !1;
|
|
455
455
|
break;
|
|
@@ -474,10 +474,10 @@ ct.write = function(u, o, s, f, l, d) {
|
|
|
474
474
|
n > a / 2 && (n = a / 2);
|
|
475
475
|
let h;
|
|
476
476
|
for (h = 0; h < n; ++h) {
|
|
477
|
-
const
|
|
478
|
-
if (nt(
|
|
477
|
+
const B = parseInt(t.substr(h * 2, 2), 16);
|
|
478
|
+
if (nt(B))
|
|
479
479
|
return h;
|
|
480
|
-
e[r + h] =
|
|
480
|
+
e[r + h] = B;
|
|
481
481
|
}
|
|
482
482
|
return h;
|
|
483
483
|
}
|
|
@@ -547,10 +547,10 @@ ct.write = function(u, o, s, f, l, d) {
|
|
|
547
547
|
let i = t;
|
|
548
548
|
for (; i < r; ) {
|
|
549
549
|
const a = e[i];
|
|
550
|
-
let h = null,
|
|
551
|
-
if (i +
|
|
550
|
+
let h = null, B = a > 239 ? 4 : a > 223 ? 3 : a > 191 ? 2 : 1;
|
|
551
|
+
if (i + B <= r) {
|
|
552
552
|
let A, F, U, I;
|
|
553
|
-
switch (
|
|
553
|
+
switch (B) {
|
|
554
554
|
case 1:
|
|
555
555
|
a < 128 && (h = a);
|
|
556
556
|
break;
|
|
@@ -564,7 +564,7 @@ ct.write = function(u, o, s, f, l, d) {
|
|
|
564
564
|
A = e[i + 1], F = e[i + 2], U = e[i + 3], (A & 192) === 128 && (F & 192) === 128 && (U & 192) === 128 && (I = (a & 15) << 18 | (A & 63) << 12 | (F & 63) << 6 | U & 63, I > 65535 && I < 1114112 && (h = I));
|
|
565
565
|
}
|
|
566
566
|
}
|
|
567
|
-
h === null ? (h = 65533,
|
|
567
|
+
h === null ? (h = 65533, B = 1) : h > 65535 && (h -= 65536, n.push(h >>> 10 & 1023 | 55296), h = 56320 | h & 1023), n.push(h), i += B;
|
|
568
568
|
}
|
|
569
569
|
return Lt(n);
|
|
570
570
|
}
|
|
@@ -714,8 +714,8 @@ ct.write = function(u, o, s, f, l, d) {
|
|
|
714
714
|
}
|
|
715
715
|
c.prototype.writeUintLE = c.prototype.writeUIntLE = function(t, r, n, i) {
|
|
716
716
|
if (t = +t, r = r >>> 0, n = n >>> 0, !i) {
|
|
717
|
-
const
|
|
718
|
-
M(this, t, r, n,
|
|
717
|
+
const B = Math.pow(2, 8 * n) - 1;
|
|
718
|
+
M(this, t, r, n, B, 0);
|
|
719
719
|
}
|
|
720
720
|
let a = 1, h = 0;
|
|
721
721
|
for (this[r] = t & 255; ++h < n && (a *= 256); )
|
|
@@ -723,8 +723,8 @@ ct.write = function(u, o, s, f, l, d) {
|
|
|
723
723
|
return r + n;
|
|
724
724
|
}, c.prototype.writeUintBE = c.prototype.writeUIntBE = function(t, r, n, i) {
|
|
725
725
|
if (t = +t, r = r >>> 0, n = n >>> 0, !i) {
|
|
726
|
-
const
|
|
727
|
-
M(this, t, r, n,
|
|
726
|
+
const B = Math.pow(2, 8 * n) - 1;
|
|
727
|
+
M(this, t, r, n, B, 0);
|
|
728
728
|
}
|
|
729
729
|
let a = n - 1, h = 1;
|
|
730
730
|
for (this[r + a] = t & 255; --a >= 0 && (h *= 256); )
|
|
@@ -764,18 +764,18 @@ ct.write = function(u, o, s, f, l, d) {
|
|
|
764
764
|
const A = Math.pow(2, 8 * n - 1);
|
|
765
765
|
M(this, t, r, n, A - 1, -A);
|
|
766
766
|
}
|
|
767
|
-
let a = 0, h = 1,
|
|
767
|
+
let a = 0, h = 1, B = 0;
|
|
768
768
|
for (this[r] = t & 255; ++a < n && (h *= 256); )
|
|
769
|
-
t < 0 &&
|
|
769
|
+
t < 0 && B === 0 && this[r + a - 1] !== 0 && (B = 1), this[r + a] = (t / h >> 0) - B & 255;
|
|
770
770
|
return r + n;
|
|
771
771
|
}, c.prototype.writeIntBE = function(t, r, n, i) {
|
|
772
772
|
if (t = +t, r = r >>> 0, !i) {
|
|
773
773
|
const A = Math.pow(2, 8 * n - 1);
|
|
774
774
|
M(this, t, r, n, A - 1, -A);
|
|
775
775
|
}
|
|
776
|
-
let a = n - 1, h = 1,
|
|
776
|
+
let a = n - 1, h = 1, B = 0;
|
|
777
777
|
for (this[r + a] = t & 255; --a >= 0 && (h *= 256); )
|
|
778
|
-
t < 0 &&
|
|
778
|
+
t < 0 && B === 0 && this[r + a + 1] !== 0 && (B = 1), this[r + a] = (t / h >> 0) - B & 255;
|
|
779
779
|
return r + n;
|
|
780
780
|
}, c.prototype.writeInt8 = function(t, r, n) {
|
|
781
781
|
return t = +t, r = r >>> 0, n || M(this, t, r, 1, 127, -128), t < 0 && (t = 255 + t + 1), this[r] = t & 255, r + 1;
|
|
@@ -798,21 +798,21 @@ ct.write = function(u, o, s, f, l, d) {
|
|
|
798
798
|
if (r < 0)
|
|
799
799
|
throw new RangeError("Index out of range");
|
|
800
800
|
}
|
|
801
|
-
function
|
|
801
|
+
function xt(e, t, r, n, i) {
|
|
802
802
|
return t = +t, r = r >>> 0, i || yt(e, t, r, 4), s.write(e, t, r, n, 23, 4), r + 4;
|
|
803
803
|
}
|
|
804
804
|
c.prototype.writeFloatLE = function(t, r, n) {
|
|
805
|
-
return
|
|
805
|
+
return xt(this, t, r, !0, n);
|
|
806
806
|
}, c.prototype.writeFloatBE = function(t, r, n) {
|
|
807
|
-
return
|
|
807
|
+
return xt(this, t, r, !1, n);
|
|
808
808
|
};
|
|
809
|
-
function
|
|
809
|
+
function Bt(e, t, r, n, i) {
|
|
810
810
|
return t = +t, r = r >>> 0, i || yt(e, t, r, 8), s.write(e, t, r, n, 52, 8), r + 8;
|
|
811
811
|
}
|
|
812
812
|
c.prototype.writeDoubleLE = function(t, r, n) {
|
|
813
|
-
return
|
|
813
|
+
return Bt(this, t, r, !0, n);
|
|
814
814
|
}, c.prototype.writeDoubleBE = function(t, r, n) {
|
|
815
|
-
return
|
|
815
|
+
return Bt(this, t, r, !1, n);
|
|
816
816
|
}, c.prototype.copy = function(t, r, n, i) {
|
|
817
817
|
if (!c.isBuffer(t))
|
|
818
818
|
throw new TypeError("argument should be a Buffer");
|
|
@@ -853,11 +853,11 @@ ct.write = function(u, o, s, f, l, d) {
|
|
|
853
853
|
for (a = r; a < n; ++a)
|
|
854
854
|
this[a] = t;
|
|
855
855
|
else {
|
|
856
|
-
const h = c.isBuffer(t) ? t : c.from(t, i),
|
|
857
|
-
if (
|
|
856
|
+
const h = c.isBuffer(t) ? t : c.from(t, i), B = h.length;
|
|
857
|
+
if (B === 0)
|
|
858
858
|
throw new TypeError('The value "' + t + '" is invalid for argument "value"');
|
|
859
859
|
for (a = 0; a < n - r; ++a)
|
|
860
|
-
this[a + r] = h[a %
|
|
860
|
+
this[a + r] = h[a % B];
|
|
861
861
|
}
|
|
862
862
|
return this;
|
|
863
863
|
};
|
|
@@ -920,8 +920,8 @@ ct.write = function(u, o, s, f, l, d) {
|
|
|
920
920
|
function Et(e, t, r, n, i, a) {
|
|
921
921
|
if (e > r || e < t) {
|
|
922
922
|
const h = typeof t == "bigint" ? "n" : "";
|
|
923
|
-
let
|
|
924
|
-
throw a > 3 ? t === 0 || t === BigInt(0) ?
|
|
923
|
+
let B;
|
|
924
|
+
throw a > 3 ? t === 0 || t === BigInt(0) ? B = `>= 0${h} and < 2${h} ** ${(a + 1) * 8}${h}` : B = `>= -(2${h} ** ${(a + 1) * 8 - 1}${h}) and < 2 ** ${(a + 1) * 8 - 1}${h}` : B = `>= ${t}${h} and <= ${r}${h}`, new G.ERR_OUT_OF_RANGE("value", B, e);
|
|
925
925
|
}
|
|
926
926
|
$t(n, i, a);
|
|
927
927
|
}
|
|
@@ -1210,7 +1210,7 @@ const ar = (u) => {
|
|
|
1210
1210
|
}, sr = (u) => {
|
|
1211
1211
|
const o = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
|
|
1212
1212
|
let s, f, l;
|
|
1213
|
-
const d = u.indexOf(".") > -1 ? u.replace(/(\d+)\.(\d+)\.(\d+)\.(\d+)/, (g, m, E,
|
|
1213
|
+
const d = u.indexOf(".") > -1 ? u.replace(/(\d+)\.(\d+)\.(\d+)\.(\d+)/, (g, m, E, x, w) => Z(m) + Z(E) + ":" + Z(x) + Z(w)) : u, [p, c] = d.split("::", 2);
|
|
1214
1214
|
if (p)
|
|
1215
1215
|
for (f = p.split(":"), s = 0; s < f.length; s++)
|
|
1216
1216
|
l = parseInt(f[s], 16), o[s * 2] = l >> 8, o[s * 2 + 1] = l & 255;
|
|
@@ -1258,14 +1258,14 @@ var Ut = {};
|
|
|
1258
1258
|
};
|
|
1259
1259
|
u.parseMetadata = p;
|
|
1260
1260
|
const c = (m) => {
|
|
1261
|
-
let E = 0,
|
|
1261
|
+
let E = 0, x = m.length - 1;
|
|
1262
1262
|
const w = d.length - 1;
|
|
1263
|
-
for (; E <= w &&
|
|
1264
|
-
E += m[
|
|
1265
|
-
return
|
|
1263
|
+
for (; E <= w && x-- > 0; )
|
|
1264
|
+
E += m[x] === d[w - E] ? 1 : -E;
|
|
1265
|
+
return x + E;
|
|
1266
1266
|
}, g = (m) => {
|
|
1267
|
-
for (let
|
|
1268
|
-
const w = m.slice(m.length - 3 -
|
|
1267
|
+
for (let x = 0; x < 20; x++) {
|
|
1268
|
+
const w = m.slice(m.length - 3 - x, m.length - x);
|
|
1269
1269
|
if (w[0] === 255 && w[1] === 255 && w[2] === 255)
|
|
1270
1270
|
return !0;
|
|
1271
1271
|
}
|
|
@@ -1277,13 +1277,13 @@ var st = {}, wr = L && L.__importDefault || function(u) {
|
|
|
1277
1277
|
return u && u.__esModule ? u : { default: u };
|
|
1278
1278
|
};
|
|
1279
1279
|
Object.defineProperty(st, "__esModule", { value: !0 });
|
|
1280
|
-
const tt = wr(H), yr = (u) => (o) => tt.default.concat3(u[o + 3], u[o + 4], u[o + 5]),
|
|
1280
|
+
const tt = wr(H), yr = (u) => (o) => tt.default.concat3(u[o + 3], u[o + 4], u[o + 5]), xr = (u) => (o) => tt.default.concat3(u[o], u[o + 1], u[o + 2]), Br = (u) => (o) => tt.default.concat4(u[o + 3] >> 4, u[o], u[o + 1], u[o + 2]), gr = (u) => (o) => tt.default.concat4(u[o + 3] & 15, u[o + 4], u[o + 5], u[o + 6]), Er = (u) => (o) => u.readUInt32BE(o), mr = (u) => (o) => u.readUInt32BE(o + 4);
|
|
1281
1281
|
st.default = (u, o) => {
|
|
1282
1282
|
switch (o) {
|
|
1283
1283
|
case 24:
|
|
1284
|
-
return { left:
|
|
1284
|
+
return { left: xr(u), right: yr(u) };
|
|
1285
1285
|
case 28:
|
|
1286
|
-
return { left:
|
|
1286
|
+
return { left: Br(u), right: gr(u) };
|
|
1287
1287
|
case 32:
|
|
1288
1288
|
return { left: Er(u), right: mr(u) };
|
|
1289
1289
|
}
|
|
@@ -1294,19 +1294,19 @@ function Ir() {
|
|
|
1294
1294
|
return It || (It = 1, Object.defineProperty(ot, "__esModule", { value: !0 })), ot;
|
|
1295
1295
|
}
|
|
1296
1296
|
(function(u) {
|
|
1297
|
-
var o = L && L.__createBinding || (Object.create ? function(
|
|
1297
|
+
var o = L && L.__createBinding || (Object.create ? function(x, w, y, _) {
|
|
1298
1298
|
_ === void 0 && (_ = y);
|
|
1299
1299
|
var S = Object.getOwnPropertyDescriptor(w, y);
|
|
1300
1300
|
(!S || ("get" in S ? !w.__esModule : S.writable || S.configurable)) && (S = { enumerable: !0, get: function() {
|
|
1301
1301
|
return w[y];
|
|
1302
|
-
} }), Object.defineProperty(
|
|
1303
|
-
} : function(
|
|
1304
|
-
_ === void 0 && (_ = y),
|
|
1305
|
-
}), s = L && L.__exportStar || function(
|
|
1306
|
-
for (var y in
|
|
1307
|
-
y !== "default" && !Object.prototype.hasOwnProperty.call(w, y) && o(w,
|
|
1308
|
-
}, f = L && L.__importDefault || function(
|
|
1309
|
-
return
|
|
1302
|
+
} }), Object.defineProperty(x, _, S);
|
|
1303
|
+
} : function(x, w, y, _) {
|
|
1304
|
+
_ === void 0 && (_ = y), x[_] = w[y];
|
|
1305
|
+
}), s = L && L.__exportStar || function(x, w) {
|
|
1306
|
+
for (var y in x)
|
|
1307
|
+
y !== "default" && !Object.prototype.hasOwnProperty.call(w, y) && o(w, x, y);
|
|
1308
|
+
}, f = L && L.__importDefault || function(x) {
|
|
1309
|
+
return x && x.__esModule ? x : { default: x };
|
|
1310
1310
|
};
|
|
1311
1311
|
Object.defineProperty(u, "__esModule", { value: !0 }), u.Reader = void 0;
|
|
1312
1312
|
const l = q, d = f(v), p = f(at), c = Ut, g = f(st), m = 16;
|
|
@@ -1379,4 +1379,7 @@ const Ur = async (u) => {
|
|
|
1379
1379
|
return l && ut.set(u, l), l;
|
|
1380
1380
|
};
|
|
1381
1381
|
window.getGeoFromIp = _r;
|
|
1382
|
+
export {
|
|
1383
|
+
_r as getGeoFromIp
|
|
1384
|
+
};
|
|
1382
1385
|
//# sourceMappingURL=index.es.js.map
|