biggystring
Advanced tools
Comparing version 4.2.0 to 4.2.1
@@ -187,3 +187,3 @@ "use strict"; | ||
function toBns(n) { | ||
let out = typeof n === 'number' ? n.toString() : n; | ||
let out = typeof n === 'number' ? n.toString() : n.replace(/^\s+|\s+$/g, ''); | ||
// Handle scientific notation | ||
@@ -190,0 +190,0 @@ const match = out.match(SCI_NOTATION_REGEX); |
@@ -39,2 +39,8 @@ "use strict"; | ||
}); | ||
it('add with spaces', function () { | ||
chai_1.assert.equal(index_1.add(' -2 ', ' '), '-2'); | ||
}); | ||
it('add with bad spaces', function () { | ||
chai_1.assert.throws(() => index_1.add(' -2 1 ', ' ')); | ||
}); | ||
}); | ||
@@ -131,2 +137,11 @@ describe('sub', function () { | ||
}); | ||
it('string number with spaces', function () { | ||
chai_1.assert.equal(index_1.toBns(' 123 '), '123'); | ||
}); | ||
it('spaces', function () { | ||
chai_1.assert.equal(index_1.toBns(' '), ''); | ||
}); | ||
it('2 spaces', function () { | ||
chai_1.assert.equal(index_1.toBns(' '), ''); | ||
}); | ||
it('scientific notation: regular numbers', function () { | ||
@@ -133,0 +148,0 @@ const numStr = '5e0'; |
{ | ||
"name": "biggystring", | ||
"version": "4.2.0", | ||
"version": "4.2.1", | ||
"description": "Full floating point big number library using regular Javascript string", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
93253
1118