File tree Expand file tree Collapse file tree 8 files changed +26
-11
lines changed
Expand file tree Collapse file tree 8 files changed +26
-11
lines changed Original file line number Diff line number Diff line change 2626 - run : npm run lint
2727 - run : npm test
2828 - run : npm run build
29+ - run : npm run test-imports
Original file line number Diff line number Diff line change @@ -4,6 +4,6 @@ node_modules
44coverage
55npm-debug.log
66.nyc_output
7- lib- *
7+ lib
88package-lock.json
99local
Original file line number Diff line number Diff line change 3939 "url" : " http://github.com/runk/mmdb-lib/issues"
4040 },
4141 "files" : [
42- " lib-commonjs" ,
43- " lib-esm"
42+ " lib"
4443 ],
45- "main" : " lib-commonjs/index.js" ,
46- "module" : " lib-esm/index.js" ,
44+ "main" : " lib/index.js" ,
4745 "typings" : " lib/index.d.ts" ,
4846 "engines" : {
4947 "node" : " >=10" ,
5553 "lint" : " eslint . --ext .ts" ,
5654 "lint:types" : " tsc --noEmit" ,
5755 "test" : " jest" ,
56+ "test-imports" : " node test/imports/commonjs.js && node test/imports/esm.mjs" ,
5857 "format" : " prettier --write src" ,
5958 "prepublish" : " npm run build" ,
6059 "semantic-release" : " semantic-release"
Original file line number Diff line number Diff line change @@ -325,8 +325,7 @@ export default class Decoder {
325325 const numberOfLongs = size / 4 ;
326326 for ( let i = 0 ; i < numberOfLongs ; i ++ ) {
327327 integer =
328- integer * BigInt ( 4294967296 ) +
329- BigInt ( buffer . readUInt32BE ( i << 2 ) ) ;
328+ integer * BigInt ( 4294967296 ) + BigInt ( buffer . readUInt32BE ( i << 2 ) ) ;
330329 }
331330
332331 return integer . toString ( ) ;
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ const fs = require ( 'fs' ) ;
2+ const assert = require ( 'assert' ) ;
3+
4+ const mmdb = require ( '../../lib/index.js' ) ;
5+ const db = fs . readFileSync ( 'test/data/test-data/GeoIP2-City-Test.mmdb' )
6+
7+ const reader = new mmdb . Reader ( db )
8+ const res = reader . get ( '175.16.199.255' ) ;
9+ assert . strictEqual ( res . city . geoname_id , 2038180 ) ;
10+ console . log ( 'commonjs: OK' ) ;
Original file line number Diff line number Diff line change 1+ import fs from 'fs' ;
2+ import assert from 'assert' ;
3+ import * as mmdb from '../../lib/index.js' ;
4+ const db = fs . readFileSync ( 'test/data/test-data/GeoIP2-City-Test.mmdb' )
5+
6+ const reader = new mmdb . Reader ( db )
7+ const res = reader . get ( '175.16.199.255' ) ;
8+ assert . strictEqual ( res . city . geoname_id , 2038180 ) ;
9+ console . log ( 'esm: OK' ) ;
Original file line number Diff line number Diff line change 33 "lib" : [" es2021" ],
44 "module" : " commonjs" ,
55 "target" : " es2021" ,
6- "outDir" : " lib-commonjs " ,
6+ "outDir" : " lib" ,
77
88 "strict" : true ,
99 "esModuleInterop" : true ,
You can’t perform that action at this time.
0 commit comments