Socket
Socket
Sign inDemoInstall

simple-format-number

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.1 to 0.1.2

5

CHANGELOG.md

@@ -13,2 +13,7 @@ # Changelog

## v0.1.2
- **Internal**
- removed lodash in favor of simple option defaults (thanks @wesleytodd)
## v0.1.1

@@ -15,0 +20,0 @@

22

index.js

@@ -1,10 +0,1 @@

var assign = require('lodash/object/assign');
var defaults = {
fractionDigits: 2,
useGrouping: true,
symbols: { // US formats
grouping: ',',
decimal: '.'
}
};
var insertGroupingRegexp = /(\d+)(\d{3})/;

@@ -21,3 +12,12 @@

function formatNumber(n, options) {
options = assign({}, defaults, options);
// Set default options
options = options || {};
options.fractionDigits = typeof options.fractionDigits !== 'undefined' ? options.fractionDigits : 2;
options.useGrouping = typeof options.useGrouping !== 'undefined' ? options.useGrouping : true;
options.symbols = typeof options.symbols !== 'undefined' ? options.symbols : {
// US formats
grouping: ',',
decimal: '.'
};
var parts = n.toFixed(options.fractionDigits).split('.');

@@ -32,2 +32,2 @@ var integerPart = parts[0];

module.exports = formatNumber;
module.exports = formatNumber;
{
"name": "simple-format-number",
"version": "0.1.1",
"version": "0.1.2",
"description": "A simple clean way to format numbers with Javascript",

@@ -23,5 +23,2 @@ "main": "index.js",

"homepage": "https://github.com/gcanti/simple-format-number",
"dependencies": {
"lodash": "^3.10.1"
},
"devDependencies": {

@@ -28,0 +25,0 @@ "eslint": "1.2.0",

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