Comparing version
'use strict'; | ||
var assert = require('assert'); | ||
var bigInt = require('big-integer'); | ||
var lru = require('tiny-lru'); | ||
var decodeBigUint = require('./bigint'); | ||
var utils = require('./utils'); | ||
@@ -44,2 +44,3 @@ | ||
this.cache = lru(opts.cache.max); | ||
this.decodeBigUint = decodeBigUint; | ||
} | ||
@@ -283,18 +284,4 @@ | ||
Decoder.prototype.decodeBigUint = function(offset, size) { | ||
var buffer = new Buffer(size); | ||
this.db.copy(buffer, 0, offset, offset + size); | ||
var integer = 0; | ||
var numberOfLongs = size / 4; | ||
for (var i = 0; i < numberOfLongs; i++) { | ||
integer = bigInt(integer).multiply(4294967296).add(buffer.readUInt32BE(i << 2, true)); | ||
} | ||
return integer.toString(); | ||
}; | ||
Decoder.prototype.decodeString = function(offset, size) { | ||
return this.db.utf8Slice(offset, offset + size); | ||
}; |
{ | ||
"name": "maxmind", | ||
"version": "2.7.0", | ||
"version": "2.8.0", | ||
"homepage": "https://github.com/runk/node-maxmind", | ||
@@ -30,9 +30,11 @@ "description": "IP lookup using Maxmind databases", | ||
"devDependencies": { | ||
"eslint": "^2.13.1", | ||
"github-publish-release": "^4.2.1", | ||
"ip-address": "^5.8.8", | ||
"istanbul": "^0.4.5", | ||
"mocha": "^5.2.0", | ||
"nyc": "^11.9.0", | ||
"sinon": "^5.1.1" | ||
"eslint": "2.13.1", | ||
"github-publish-release": "5.0.1", | ||
"ip-address": "5.8.9", | ||
"istanbul": "0.4.5", | ||
"mocha": "5.2.0", | ||
"nyc": "13.1.0", | ||
"sinon": "7.1.1", | ||
"tslint": "^5.11.0", | ||
"typescript": "^3.1.1" | ||
}, | ||
@@ -48,2 +50,3 @@ "repository": { | ||
"main": "index.js", | ||
"typings": "./index.d.ts", | ||
"engines": { | ||
@@ -50,0 +53,0 @@ "node": ">=4.8", |
@@ -1,2 +0,2 @@ | ||
node-maxmind [](https://travis-ci.org/runk/node-maxmind) | ||
node-maxmind [](https://travis-ci.org/runk/node-maxmind) | ||
======== | ||
@@ -80,3 +80,3 @@ | ||
watchForUpdates: true, | ||
watchForUpdateNonPersistent: true, | ||
watchForUpdatesNonPersistent: true, | ||
}); | ||
@@ -83,0 +83,0 @@ lookup.get('1.1.1.1'); |
Sorry, the diff of this file is not supported yet
2119029
0.11%84
5%62899
0.22%9
28.57%