Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

numeral

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

numeral - npm Package Compare versions

Comparing version 1.2.1 to 1.2.2

languages/en-gb.js

2

languages/fr.js

@@ -17,3 +17,3 @@ // numeral.js language configuration

},
money: {
currency: {
symbol: '€'

@@ -20,0 +20,0 @@ }

// numeral.js
// version : 1.2.1
// version : 1.2.2
// author : Adam Draper
// license : MIT
// http://adamwdraper.github.com/Numeral-js/
(function(){function u(e){this._n=e}function a(e,t){var n=Math.pow(10,t);return(Math.round(e*n)/n).toFixed(t)}function f(e,t){var n;t.indexOf("$")>-1?n=c(e,t):t.indexOf("%")>-1?n=h(e,t):t.indexOf(":")>-1?n=p(e,t):n=v(e,t);return n}function l(e,t){if(t.indexOf(":")>-1)e._n=d(t);else{i[s].delimiters.decimal!=="."&&(t=t.replace(i[s].delimiters.decimal,"."));var n=new RegExp(i[s].abbreviations.thousand+"(?:\\)|\\"+i[s].money.symbol+"?)$"),r=new RegExp(i[s].abbreviations.million+"(?:\\)|\\"+i[s].money.symbol+"?)$");e._n=(t.match(n)?1e3:1)*(t.match(r)?1e6:1)*(t.indexOf("%")>-1?.01:1)*Number((t.indexOf("(")>-1?"-":"")+t.replace(/[^0-9\.'-]+/g,""))}return e._n}function c(e,t){t=t.replace("$","");var n=f(e,t);if(n.indexOf("(")>-1||n.indexOf("-")>-1){n=n.split("");n.splice(1,0,i[s].money.symbol);n=n.join("")}else n=i[s].money.symbol+n;return n}function h(e,t){t=t.replace("%","");e._n=e._n*100;var n=f(e,t);if(n.indexOf(")")>-1){n=n.split("");n.splice(-1,0,"%");n=n.join("")}else n+="%";return n}function p(e,t){var n=Math.floor(e._n/60/60),r=Math.floor((e._n-n*60*60)/60),i=Math.round(e._n-n*60*60-r*60);return n+":"+(r<10?"0"+r:r)+":"+(i<10?"0"+i:i)}function d(e){var t=e.split(":"),n=0;if(t.length===3){n+=Number(t[0])*60*60;n+=Number(t[1])*60;n+=Number(t[2])}else if(t.lenght===2){n+=Number(t[0])*60;n+=Number(t[1])}return Number(n)}function v(e,t){var n=!1,r=!1,o=!1;if(t.indexOf("(")>-1){n=!0;t=t.slice(1,-1)}if(t.indexOf("a")>-1){t=t.replace("a","");if(e._n>1e6){r=i[s].abbreviations.million;e._n=e._n/1e6}else{r=i[s].abbreviations.thousand;e._n=e._n/1e3}}if(t.indexOf("o")>-1){t=t.replace("o","");o=i[s].ordinal(e._n)}var u=e._n.toString().split(".")[0],f=t.split(".")[1],l=t.indexOf(","),c="",h=!1;if(e._n<0){u=u.slice(1);h=!0}l>-1&&(u=u.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+i[s].delimiters.thousands));t.indexOf(".")===0&&(u="");f&&(c=i[s].delimiters.decimal+a(e._n,f.length).split(".")[1]);r;return(n&&h?"(":"")+(!n&&h?"-":"")+u+c+(o?o:"")+(r?r:"")+(n&&h?")":"")}function m(e,t){i[e]=t}var e,t="1.2.1",n=Math.round,r,i={},s="en",o=typeof module!="undefined"&&module.exports;e=function(t){e.isNumeral(t)?t=t.value():Number(t)||(t=0);return new u(Number(t))};e.isNumeral=function(e){return e instanceof u};e.version=t;e.isNumeral=function(e){return e instanceof u};e.language=function(e,t){if(!e)return s;e&&!t&&(s=e);(t||!i[e])&&m(e,t);return i};e.language("en",{delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"k",million:"m"},ordinal:function(e){var t=e%10;return~~(e%100/10)===1?"th":t===1?"st":t===2?"nd":t===3?"rd":"th"},money:{symbol:"$"}});e.fn=u.prototype={clone:function(){return e(this)},format:function(t){return f(this,t?t:e.defaultFormat)},unformat:function(t){return l(this,t?t:e.defaultFormat)},value:function(){return this._n},set:function(e){this._n=Number(e);return this},add:function(e){this._n=this._n+Number(e);return this},subtract:function(e){this._n=this._n-Number(e);return this},multiply:function(e){this._n=this._n*Number(e);return this},divide:function(e){this._n=this._n/Number(e);return this},difference:function(e){var t=this._n-Number(e);t<0&&(t=-t);return t}};o&&(module.exports=e);typeof ender=="undefined"&&(this.numeral=e);typeof define=="function"&&define.amd&&define([],function(){return e})}).call(this);
(function(){function u(e){this._n=e}function a(e,t){var n=Math.pow(10,t);return(Math.round(e*n)/n).toFixed(t)}function f(e,t){var n;t.indexOf("$")>-1?n=c(e,t):t.indexOf("%")>-1?n=h(e,t):t.indexOf(":")>-1?n=p(e,t):n=v(e,t);return n}function l(e,t){if(t.indexOf(":")>-1)e._n=d(t);else{i[s].delimiters.decimal!=="."&&(t=t.replace(i[s].delimiters.decimal,"."));var n=new RegExp(i[s].abbreviations.thousand+"(?:\\)|\\"+i[s].currency.symbol+"?)$"),r=new RegExp(i[s].abbreviations.million+"(?:\\)|\\"+i[s].currency.symbol+"?)$");e._n=(t.match(n)?1e3:1)*(t.match(r)?1e6:1)*(t.indexOf("%")>-1?.01:1)*Number((t.indexOf("(")>-1?"-":"")+t.replace(/[^0-9\.'-]+/g,""))}return e._n}function c(e,t){t=t.replace("$","");var n=f(e,t);if(n.indexOf("(")>-1||n.indexOf("-")>-1){n=n.split("");n.splice(1,0,i[s].currency.symbol);n=n.join("")}else n=i[s].currency.symbol+n;return n}function h(e,t){t=t.replace("%","");e._n=e._n*100;var n=f(e,t);if(n.indexOf(")")>-1){n=n.split("");n.splice(-1,0,"%");n=n.join("")}else n+="%";return n}function p(e,t){var n=Math.floor(e._n/60/60),r=Math.floor((e._n-n*60*60)/60),i=Math.round(e._n-n*60*60-r*60);return n+":"+(r<10?"0"+r:r)+":"+(i<10?"0"+i:i)}function d(e){var t=e.split(":"),n=0;if(t.length===3){n+=Number(t[0])*60*60;n+=Number(t[1])*60;n+=Number(t[2])}else if(t.lenght===2){n+=Number(t[0])*60;n+=Number(t[1])}return Number(n)}function v(e,t){var n=!1,r=!1,o=!1;if(t.indexOf("(")>-1){n=!0;t=t.slice(1,-1)}if(t.indexOf("a")>-1){t=t.replace("a","");if(e._n>1e6){r=i[s].abbreviations.million;e._n=e._n/1e6}else{r=i[s].abbreviations.thousand;e._n=e._n/1e3}}if(t.indexOf("o")>-1){t=t.replace("o","");o=i[s].ordinal(e._n)}var u=e._n.toString().split(".")[0],f=t.split(".")[1],l=t.indexOf(","),c="",h=!1;if(e._n<0){u=u.slice(1);h=!0}l>-1&&(u=u.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+i[s].delimiters.thousands));t.indexOf(".")===0&&(u="");f&&(c=i[s].delimiters.decimal+a(e._n,f.length).split(".")[1]);r;return(n&&h?"(":"")+(!n&&h?"-":"")+u+c+(o?o:"")+(r?r:"")+(n&&h?")":"")}function m(e,t){i[e]=t}var e,t="1.2.2",n=Math.round,r,i={},s="en",o=typeof module!="undefined"&&module.exports;e=function(t){e.isNumeral(t)?t=t.value():Number(t)||(t=0);return new u(Number(t))};e.isNumeral=function(e){return e instanceof u};e.version=t;e.isNumeral=function(e){return e instanceof u};e.language=function(e,t){if(!e)return s;e&&!t&&(s=e);(t||!i[e])&&m(e,t);return i};e.language("en",{delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"k",million:"m"},ordinal:function(e){var t=e%10;return~~(e%100/10)===1?"th":t===1?"st":t===2?"nd":t===3?"rd":"th"},currency:{symbol:"$"}});e.fn=u.prototype={clone:function(){return e(this)},format:function(t){return f(this,t?t:e.defaultFormat)},unformat:function(t){return l(this,t?t:e.defaultFormat)},value:function(){return this._n},set:function(e){this._n=Number(e);return this},add:function(e){this._n=this._n+Number(e);return this},subtract:function(e){this._n=this._n-Number(e);return this},multiply:function(e){this._n=this._n*Number(e);return this},divide:function(e){this._n=this._n/Number(e);return this},difference:function(e){var t=this._n-Number(e);t<0&&(t=-t);return t}};o&&(module.exports=e);typeof ender=="undefined"&&(this.numeral=e);typeof define=="function"&&define.amd&&define([],function(){return e})}).call(this);
// numeral.js
// version : 1.2.1
// version : 1.2.2
// author : Adam Draper

@@ -15,3 +15,3 @@ // license : MIT

var numeral,
VERSION = '1.2.1',
VERSION = '1.2.2',
round = Math.round, i,

@@ -57,4 +57,4 @@ // internal storage for language config files

// figure out what kind of format we are dealing with
if (format.indexOf('$') > -1) { // money!!!!!
output = formatMoney(n, format);
if (format.indexOf('$') > -1) { // currency!!!!!
output = formatCurrency(n, format);
} else if (format.indexOf('%') > -1) { // percentage

@@ -80,4 +80,4 @@ output = formatPercentage(n, format);

}
var thousandRegExp = new RegExp(languages[currentLanguage].abbreviations.thousand + '(?:\\)|\\' + languages[currentLanguage].money.symbol + '?)$'),
millionRegExp = new RegExp(languages[currentLanguage].abbreviations.million + '(?:\\)|\\' + languages[currentLanguage].money.symbol + '?)$');
var thousandRegExp = new RegExp(languages[currentLanguage].abbreviations.thousand + '(?:\\)|\\' + languages[currentLanguage].currency.symbol + '?)$'),
millionRegExp = new RegExp(languages[currentLanguage].abbreviations.million + '(?:\\)|\\' + languages[currentLanguage].currency.symbol + '?)$');
n._n = ((string.match(thousandRegExp)) ? 1000 : 1) * ((string.match(millionRegExp)) ? 1000000 : 1) * ((string.indexOf('%') > -1) ? 0.01 : 1) * Number(((string.indexOf('(') > -1) ? '-' : '') + string.replace(/[^0-9\.'-]+/g, ''));

@@ -88,3 +88,3 @@ }

function formatMoney (n, format) {
function formatCurrency (n, format) {
format = format.replace('$', '');

@@ -94,6 +94,6 @@ var output = formatNumeral(n, format);

output = output.split('');
output.splice(1, 0, languages[currentLanguage].money.symbol);
output.splice(1, 0, languages[currentLanguage].currency.symbol);
output = output.join('');
} else {
output = languages[currentLanguage].money.symbol + output;
output = languages[currentLanguage].currency.symbol + output;
}

@@ -269,3 +269,3 @@ return output;

},
money: {
currency: {
symbol: '$'

@@ -272,0 +272,0 @@ }

{
"name": "numeral",
"version": "1.2.1",
"version": "1.2.2",
"description": "Format and manipulate numbers.",
"homepage": "http://adamwdraper.github.com/Numeral-js/",
"homepage": "http://numeraljs.com",
"author": {

@@ -37,5 +37,5 @@ "name": "Adam Draper",

"ender": "./ender.js",
"readme": "[Numeral.js](http://adamwdraper.github.com/Numeral-js/)\n=======================================================\n\nA javascript library for formatting and manipulating numbers.\n\n[Website and documentation](http://adamwdraper.github.com/Numeral-js/)\n\nChangelog\n=========\n\n### 1.2.1\nBug fix: Fix unformatting non-negative abbreviations\n### 1.2.0\nAdd localization language support\n\nUpdate testing for to include languages\n### 1.1.0\nAdd Tests\n\nBug fix: Fix difference returning negative values\n### 1.0.4\nBug fix: Non negative numbers were displaying as negative when using parentheses\n### 1.0.3\nAdd ordinal formatting using 'o' in the format\n### 1.0.2\nAdd clone functionality\n### 1.0.1\n\nAdded abbreviations for thousands and millions using 'a' in the format\n\n### 1.0.0\n\nInitial release\n\nAcknowlegements\n===============\n\nNumeral.js, while less complex, was inspired by and heavily borrowed from [Moment.js](http://momentjs.com)\n\nLicense\n=======\nNumeral.js is freely distributable under the terms of the MIT license.\nCopyright (c) 2012 Adam Draper\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use,copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
"_id": "numeral@1.2.1",
"readme": "[Numeral.js](http://numeraljs.com)\n=======================================================\n\nA javascript library for formatting and manipulating numbers.\n\n[Website and documentation](http://adamwdraper.github.com/Numeral-js/)\n\nChangelog\n=========\n\n### 1.2.2\nChanged language definition property 'money' to 'currency'\n### 1.2.1\nBug fix: Fix unformatting non-negative abbreviations\n### 1.2.0\nAdd localization language support\n\nUpdate testing for to include languages\n### 1.1.0\nAdd Tests\n\nBug fix: Fix difference returning negative values\n### 1.0.4\nBug fix: Non negative numbers were displaying as negative when using parentheses\n### 1.0.3\nAdd ordinal formatting using 'o' in the format\n### 1.0.2\nAdd clone functionality\n### 1.0.1\n\nAdded abbreviations for thousands and millions using 'a' in the format\n\n### 1.0.0\n\nInitial release\n\nAcknowlegements\n===============\n\nNumeral.js, while less complex, was inspired by and heavily borrowed from [Moment.js](http://momentjs.com)\n\nLicense\n=======\nNumeral.js is freely distributable under the terms of the MIT license.\nCopyright (c) 2012 Adam Draper\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use,copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
"_id": "numeral@1.2.2",
"_from": "numeral"
}

@@ -6,3 +6,3 @@ [Numeral.js](http://adamwdraper.github.com/Numeral-js/)

[Website and documentation](http://adamwdraper.github.com/Numeral-js/)
[Website and documentation](http://numeraljs.com/)

@@ -13,2 +13,6 @@

### 1.2.2
Changed language definition property 'money' to 'currency'
### 1.2.1

@@ -15,0 +19,0 @@

@@ -32,4 +32,4 @@ module('Language: en', {

// Money -----------------------
test('Format Money', 4, function() {
// Currency -----------------------
test('Format Currency', 4, function() {
var tests = [

@@ -36,0 +36,0 @@ [1000.234,'$0,0.00','$1,000.23'],

@@ -32,4 +32,4 @@ module('Language: fr', {

// Money -----------------------
test('Format Money', 4, function() {
// Currency -----------------------
test('Format Currency', 4, function() {
var tests = [

@@ -36,0 +36,0 @@ [1000.234,'$0,0.00','€1 000,23'],

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc