Skip to content

Commit f6f2fff

Browse files
committed
refactor(grabber): replace deprecated bignum with built-in BigInt
1 parent 4126f85 commit f6f2fff

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

package-lock.json

Lines changed: 8 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
"homepage": "https://github.com/NyaaCat/NyaaStats#readme",
3333
"dependencies": {
3434
"axios": "^0.19.2",
35-
"bignum": "^0.13.1",
3635
"fs-extra": "^2.0.0",
3736
"gauge": "^2.7.4",
3837
"inquirer": "^5.2.0",

utils.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
const axios = require('axios')
2-
const bignum = require('bignum')
32
const NBT = require('mcnbt')
43
const path = require('path')
54
const yaml = require('js-yaml')
@@ -37,7 +36,7 @@ module.exports = class Utils {
3736
path.join(this.config.render.level),
3837
(err) => {
3938
if (err) return reject(err)
40-
return resolve(bignum(nbt.select('').select('Data').select('Time').getValue()).toNumber() / 20)
39+
return resolve(Number(BigInt(nbt.select('').select('Data').select('Time').getValue())) / 20)
4140
},
4241
)
4342
})
@@ -134,10 +133,10 @@ module.exports = class Utils {
134133
lived = nbt.select('').select('Spigot.ticksLived').getValue() / 20
135134
}
136135
const timeStart = nbt.select('').select('bukkit')
137-
? bignum(nbt.select('').select('bukkit').select('firstPlayed').getValue()).toNumber()
136+
? BigInt(nbt.select('').select('bukkit').select('firstPlayed').getValue())
138137
: null
139138
const timeLast = nbt.select('').select('bukkit')
140-
? bignum(nbt.select('').select('bukkit').select('lastPlayed').getValue()).toNumber()
139+
? BigInt(nbt.select('').select('bukkit').select('lastPlayed').getValue())
141140
: null
142141
const pdata = {
143142
seen: timeLast,

0 commit comments

Comments
 (0)