From 09497968d0d73833bbee68cdbc9e5a90aaea2f97 Mon Sep 17 00:00:00 2001 From: frankledo Date: Wed, 22 Nov 2023 17:07:31 -0800 Subject: [PATCH 1/2] Removed @extra-number/significant-digits package that is no longer supported and replaced call with local code. --- lib/dynamodb.js | 4 +--- package.json | 1 - 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/dynamodb.js b/lib/dynamodb.js index d949ae8..718e2f1 100644 --- a/lib/dynamodb.js +++ b/lib/dynamodb.js @@ -2,8 +2,6 @@ const RecordEventMock = require( './record' ); -const significantDigits = require( '@extra-number/significant-digits' ); - const constants = require( './constants' ); @@ -14,7 +12,7 @@ function calculateLength( type, value ) { switch( type ) { case 'N': - length = significantDigits( Number( value ) ); + length = value.toExponential().replace(/e[+\-0-9]*$/, '').replace(/^0\.?0*|\./, '').length; break; case 'BOOL': diff --git a/package.json b/package.json index c28e786..7dc4105 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,6 @@ "author": "Vandium Software Inc.", "license": "BSD-3-Clause", "dependencies": { - "@extra-number/significant-digits": "^1.1.1", "clone-deep": "^4.0.1", "uuid": "^3.3.3", "vandium-utils": "^1.2.0" From 73e68ac9d6300422e9004a090caa22f2ed8a1162 Mon Sep 17 00:00:00 2001 From: frankledo Date: Wed, 22 Nov 2023 17:19:29 -0800 Subject: [PATCH 2/2] Wrapping value in Number --- lib/dynamodb.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/dynamodb.js b/lib/dynamodb.js index 718e2f1..9e91359 100644 --- a/lib/dynamodb.js +++ b/lib/dynamodb.js @@ -12,7 +12,7 @@ function calculateLength( type, value ) { switch( type ) { case 'N': - length = value.toExponential().replace(/e[+\-0-9]*$/, '').replace(/^0\.?0*|\./, '').length; + length = Number(value).toExponential().replace(/e[+\-0-9]*$/, '').replace(/^0\.?0*|\./, '').length; break; case 'BOOL':