From e68aa286f28b7bcac767205b9fff31dc1d8c5e8a Mon Sep 17 00:00:00 2001 From: Junwei Ma Date: Tue, 27 Mar 2018 11:53:36 -0400 Subject: [PATCH 1/2] fix string start with number issue --- lib/utils.js | 13 +++++++++---- package.json | 4 ++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/lib/utils.js b/lib/utils.js index a75f1ca..8833bb1 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -31,11 +31,16 @@ function maybeIsNumber(n) { if (n instanceof Long) { return n; } - var asNum = parseFloat(n); - if (isNaN(asNum)) { - return undefined; + var regPos = /^\d+(\.\d+)?$/; //Float number + var regNeg = /^(-(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*)))$/;//Float number below zero + if (regPos.test(n) || regNeg.test(n)) { + var asNum = parseFloat(n); + if (isNaN(asNum)) { + return undefined; + } + return asNum; } - return asNum; + return n; } function isInteger(n) { diff --git a/package.json b/package.json index 086ada4..9894378 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { - "name": "basho-riak-client", + "name": "basho-riak-client-covs", "description": "Basho's officially supported NodeJS client for Riak", - "version": "2.4.0", + "version": "2.4.1", "author": "Brian Roach ", "contributors": [ "Luke Bakken ", From a4bcc7bf1af4faf236c88231aee985312bc76504 Mon Sep 17 00:00:00 2001 From: jma1987 Date: Tue, 27 Mar 2018 13:26:07 -0400 Subject: [PATCH 2/2] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9894378..aa43121 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "basho-riak-client-covs", "description": "Basho's officially supported NodeJS client for Riak", - "version": "2.4.1", + "version": "2.4.1-alpha1", "author": "Brian Roach ", "contributors": [ "Luke Bakken ",