From bcdcd99b643d6a6dfa934a01e64dafeb2fbf7c39 Mon Sep 17 00:00:00 2001 From: mblakley Date: Thu, 19 Oct 2023 06:55:27 -0400 Subject: [PATCH] SNOW-922989 Replace deprecated bignumber.js floor function (#649) * Replace deprecated bignumber floor function with integerValue calls * Update bignumber.js dependency to require v9.1.2 and up --- lib/connection/result/column.js | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/connection/result/column.js b/lib/connection/result/column.js index 9eafd3837..42671cbb8 100644 --- a/lib/connection/result/column.js +++ b/lib/connection/result/column.js @@ -456,10 +456,10 @@ function convertRawTimestampTz(rawColumnValue, column, context) // extract everything but the lowest 14 bits to get the fractional seconds valFracSecsBig = - valFracSecsWithTzBig.dividedBy(16384).floor(); + valFracSecsWithTzBig.dividedBy(16384).integerValue(BigNumber.ROUND_FLOOR); // extract the lowest 14 bits to get the timezone - if (valFracSecsWithTzBig.greaterThanOrEqualTo(0)) + if (valFracSecsWithTzBig.isGreaterThanOrEqualTo(0)) { timezoneBig = valFracSecsWithTzBig.modulo(16384); } @@ -521,7 +521,7 @@ function convertRawTimestampHelper( // split the value into epoch seconds + nanoseconds; for example, // 1365148923.123456789 will be split into 1365148923 (epoch seconds) // and 123456789 (nano seconds) - var valSecBig = epochFracSecsBig.dividedBy(scaleFactor).floor(); + var valSecBig = epochFracSecsBig.dividedBy(scaleFactor).integerValue(BigNumber.ROUND_FLOOR); var fractionsBig = epochFracSecsBig.minus(valSecBig.times(scaleFactor)); var valSecNanoBig = fractionsBig.times(Math.pow(10, 9 - scale)); diff --git a/package.json b/package.json index 47bdc107f..4477d752e 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "asn1.js-rfc5280": "^3.0.0", "axios": "^1.5.1", "big-integer": "^1.6.43", - "bignumber.js": "^2.4.0", + "bignumber.js": "^9.1.2", "binascii": "0.0.2", "bn.js": "^5.2.1", "browser-request": "^0.3.3",