Socket
Socket
Sign inDemoInstall

format-number-with-string

Package Overview
Dependencies
2
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.1 to 0.0.2

4

package.json
{
"name": "format-number-with-string",
"version": "0.0.1",
"version": "0.0.2",
"description": "Format a number based on a format string '-£#,##0.##0'",

@@ -22,3 +22,3 @@ "main": "index.js",

"deconstruct-number-format": "~0.0.1",
"format-number": "^2.0.0"
"format-number": "^2.0.1"
},

@@ -25,0 +25,0 @@ "devDependencies": {

@@ -140,2 +140,22 @@ 'use strict';

});
test('rounding', function () {
var actual = format('512.996', '###.00');
var expected = '513.00';
assert.deepEqual(actual, expected);
});
test('rounding ZerosAfterDB', function () {
var actual = format('0.00000447343434434', '#.######0');
var expected = '0.0000045';
assert.deepEqual(actual, expected);
});
test('rounding decimal to integer', function () {
var actual = format('0.99', '#.0');
var expected = '1.0';
assert.deepEqual(actual, expected);
});
test('rounding decimal', function () {
var actual = format('0.099', '#.#0');
var expected = '0.10';
assert.deepEqual(actual, expected);
});

@@ -142,0 +162,0 @@ //decimal and separators

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc