Skip to content

Commit

Permalink
Release 1.7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
BenjaminVanRyseghem committed Apr 11, 2016
1 parent 2635430 commit 38cc4de
Show file tree
Hide file tree
Showing 13 changed files with 106 additions and 72 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
### 1.7.1

- Fix #142: Limit packaging extraneous files. Thanks @MarkHerhold.
- Fix #143: Fixing web build. Thanks @mmollick.
- Fix #149: Allow loading of cultures in node explicitly if numbro hasn't detected correctly that it is in node. Thanks @stewart42.
- Fix #147: Fixing formatting issues for very small (+/-1e-23) numbers. Thanks @MarkHerhold.

### 1.7.0

- Fix decimal rounding issue. Thanks @Shraymonks.
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "numbro",
"repo": "foretagsplatsen/numbro",
"version": "1.7.0",
"version": "1.7.1",
"description": "Format and manipulate numbers.",
"keywords": [
"numeral",
Expand Down
2 changes: 1 addition & 1 deletion component.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "numbro",
"repo": "foretagsplatsen/numbro",
"version": "1.7.0",
"version": "1.7.1",
"description": "Format and manipulate numbers.",
"keywords": [
"numeral",
Expand Down
34 changes: 0 additions & 34 deletions dist/languages.js
Original file line number Diff line number Diff line change
Expand Up @@ -853,40 +853,6 @@
}
}.call(typeof window === 'undefined' ? this : window));

exports['cs-CZ'] = require('./cs-CZ.js');
exports['da-DK'] = require('./da-DK.js');
exports['de-CH'] = require('./de-CH.js');
exports['de-DE'] = require('./de-DE.js');
exports['en-GB'] = require('./en-GB.js');
exports['en-ZA'] = require('./en-ZA.js');
exports['es-AR'] = require('./es-AR.js');
exports['es-ES'] = require('./es-ES.js');
exports['et-EE'] = require('./et-EE.js');
exports['fa-IR'] = require('./fa-IR.js');
exports['fi-FI'] = require('./fi-FI.js');
exports['fil-PH'] = require('./fil-PH.js');
exports['fr-CA'] = require('./fr-CA.js');
exports['fr-CH'] = require('./fr-CH.js');
exports['fr-FR'] = require('./fr-FR.js');
exports['he-IL'] = require('./he-IL.js');
exports['hu-HU'] = require('./hu-HU.js');
exports['it-IT'] = require('./it-IT.js');
exports['ja-JP'] = require('./ja-JP.js');
exports['lv-LV'] = require('./lv-LV.js');
exports['nb-NO'] = require('./nb-NO.js');
exports['nl-BE'] = require('./nl-BE.js');
exports['nl-NL'] = require('./nl-NL.js');
exports['pl-PL'] = require('./pl-PL.js');
exports['pt-BR'] = require('./pt-BR.js');
exports['pt-PT'] = require('./pt-PT.js');
exports['ru-RU'] = require('./ru-RU.js');
exports['ru-UA'] = require('./ru-UA.js');
exports['sk-SK'] = require('./sk-SK.js');
exports['sv-SE'] = require('./sv-SE.js');
exports['th-TH'] = require('./th-TH.js');
exports['tr-TR'] = require('./tr-TR.js');
exports['uk-UA'] = require('./uk-UA.js');
exports['zh-CN'] = require('./zh-CN.js');
/*!
* numbro.js language configuration
* language : Italian
Expand Down
2 changes: 1 addition & 1 deletion dist/languages.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ trillion:"T"},ordinal:function(){return"."},currency:{symbol:" Ft",position:"pos
// CommonJS
"undefined"!=typeof module&&module.exports&&(module.exports=a),
// Browser
"undefined"!=typeof window&&window.numbro&&window.numbro.culture&&window.numbro.culture(a.cultureCode,a)}.call("undefined"==typeof window?this:window),exports["cs-CZ"]=require("./cs-CZ.js"),exports["da-DK"]=require("./da-DK.js"),exports["de-CH"]=require("./de-CH.js"),exports["de-DE"]=require("./de-DE.js"),exports["en-GB"]=require("./en-GB.js"),exports["en-ZA"]=require("./en-ZA.js"),exports["es-AR"]=require("./es-AR.js"),exports["es-ES"]=require("./es-ES.js"),exports["et-EE"]=require("./et-EE.js"),exports["fa-IR"]=require("./fa-IR.js"),exports["fi-FI"]=require("./fi-FI.js"),exports["fil-PH"]=require("./fil-PH.js"),exports["fr-CA"]=require("./fr-CA.js"),exports["fr-CH"]=require("./fr-CH.js"),exports["fr-FR"]=require("./fr-FR.js"),exports["he-IL"]=require("./he-IL.js"),exports["hu-HU"]=require("./hu-HU.js"),exports["it-IT"]=require("./it-IT.js"),exports["ja-JP"]=require("./ja-JP.js"),exports["lv-LV"]=require("./lv-LV.js"),exports["nb-NO"]=require("./nb-NO.js"),exports["nl-BE"]=require("./nl-BE.js"),exports["nl-NL"]=require("./nl-NL.js"),exports["pl-PL"]=require("./pl-PL.js"),exports["pt-BR"]=require("./pt-BR.js"),exports["pt-PT"]=require("./pt-PT.js"),exports["ru-RU"]=require("./ru-RU.js"),exports["ru-UA"]=require("./ru-UA.js"),exports["sk-SK"]=require("./sk-SK.js"),exports["sv-SE"]=require("./sv-SE.js"),exports["th-TH"]=require("./th-TH.js"),exports["tr-TR"]=require("./tr-TR.js"),exports["uk-UA"]=require("./uk-UA.js"),exports["zh-CN"]=require("./zh-CN.js"),/*!
"undefined"!=typeof window&&window.numbro&&window.numbro.culture&&window.numbro.culture(a.cultureCode,a)}.call("undefined"==typeof window?this:window),/*!
* numbro.js language configuration
* language : Italian
* locale: Italy
Expand Down
1 change: 1 addition & 0 deletions dist/languages/index.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions dist/languages/ko-KR.min.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*!
* numbro.js language configuration
* language : Korean
* author (numbro.js Version): Randy Wilander : https://github.com/rocketedaway
* author (numeral.js Version) : Rich Daley : https://github.com/pedantic-git
*/
(function(){"use strict";var a={langLocaleCode:"ko-KR",cultureCode:"ko-KR",delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"천",million:"백만",billion:"십억",trillion:"일조"},ordinal:function(){return"."},currency:{symbol:"₩"}};
// CommonJS
"undefined"!=typeof module&&module.exports&&(module.exports=a),
// Browser
"undefined"!=typeof window&&window.numbro&&window.numbro.culture&&window.numbro.culture(a.cultureCode,a)}).call("undefined"==typeof window?this:window);
11 changes: 11 additions & 0 deletions dist/languages/zh-TW.min.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*!
* numbro.js language configuration
* language : Chinese (Taiwan)
* author (numbro.js Version): Randy Wilander : https://github.com/rocketedaway
* author (numeral.js Version) : Rich Daley : https://github.com/pedantic-git
*/
(function(){"use strict";var a={langLocaleCode:"zh-TW",cultureCode:"zh-TW",delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"千",million:"百萬",billion:"十億",trillion:"兆"},ordinal:function(){return"第"},currency:{symbol:"NT$"}};
// CommonJS
"undefined"!=typeof module&&module.exports&&(module.exports=a),
// Browser
"undefined"!=typeof window&&window.numbro&&window.numbro.culture&&window.numbro.culture(a.cultureCode,a)}).call("undefined"==typeof window?this:window);
68 changes: 48 additions & 20 deletions dist/numbro.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* numbro.js
* version : 1.7.0
* version : 1.7.1
* author : Företagsplatsen AB
* license : MIT
* http://www.foretagsplatsen.se
Expand All @@ -14,7 +14,7 @@
************************************/

var numbro,
VERSION = '1.7.0',
VERSION = '1.7.1',
// internal storage for culture config files
cultures = {},
// Todo: Remove in 2.0.0
Expand Down Expand Up @@ -78,27 +78,52 @@
return ret;
}
/**
* Implementation of toFixed() for numbers with exponent > 21
*
*
* Implementation of toFixed() for numbers with exponents
* This function may return negative representations for zero values e.g. "-0.0"
*/
function toFixedLarge(value, precision) {
function toFixedLargeSmall(value, precision) {
var mantissa,
beforeDec,
afterDec,
exponent,
prefix,
endStr,
zerosStr,
str;

str = value.toString();

mantissa = str.split('e')[0];
exponent = str.split('e')[1];
exponent = str.split('e')[1];

beforeDec = mantissa.split('.')[0];
afterDec = mantissa.split('.')[1] || '';

str = beforeDec + afterDec + zeroes(exponent - afterDec.length);
if (precision > 0) {
if (+exponent > 0) {
// exponent is positive - add zeros after the numbers
str = beforeDec + afterDec + zeroes(exponent - afterDec.length);
} else {
// exponent is negative

if (+beforeDec < 0) {
prefix = '-0';
} else {
prefix = '0';
}

// tack on the decimal point if needed
if (precision > 0) {
prefix += '.';
}

zerosStr = zeroes((-1 * exponent) - 1);
// substring off the end to satisfy the precision
endStr = (zerosStr + Math.abs(beforeDec) + afterDec).substr(0, precision);
str = prefix + endStr;
}

// only add percision 0's if the exponent is positive
if (+exponent > 0 && precision > 0) {
str += '.' + zeroes(precision);
}

Expand All @@ -110,16 +135,21 @@
*
* Fixes binary rounding issues (eg. (0.615).toFixed(2) === '0.61') that present
* problems for accounting- and finance-related software.
*
* Also removes negative signs for zero-formatted numbers. e.g. -0.01 w/ precision 1 -> 0.0
*/
function toFixed(value, precision, roundingFunction, optionals) {
var power = Math.pow(10, precision),
optionalsRegExp,
output;

if (value.toFixed(0).search('e') > -1) {
// Above 1e21, toFixed returns scientific notation, which
// is useless and unexpected
output = toFixedLarge(value, precision);
if (value.toString().indexOf('e') > -1) {
// toFixed returns scientific notation for numbers above 1e21 and below 1e-7
output = toFixedLargeSmall(value, precision);
// remove the leading negative sign if it exists and should not be present (e.g. -0.00)
if (output.charAt(0) === '-' && +output >= 0) {
output = output.substr(1); // chop off the '-'
}
}
else {
// Multiply up by precision, round accurately, then divide and use native toFixed():
Expand Down Expand Up @@ -960,10 +990,6 @@
};

numbro.loadCulturesInNode = function() {
if (!inNodejsRuntime()) {
return;
}

// TODO: Rename the folder in 2.0.0
var cultures = require('./languages');

Expand Down Expand Up @@ -996,7 +1022,7 @@
function inNodejsRuntime() {
return (typeof process !== 'undefined') &&
(process.browser === undefined) &&
(process.title === 'node' || process.title === 'grunt') &&
(process.title === 'node' || process.title === 'grunt' || process.title === 'gulp') &&
(typeof require !== 'undefined');
}

Expand Down Expand Up @@ -1178,8 +1204,10 @@
Exposing Numbro
************************************/

//Todo: Rename the folder in 2.0.0
numbro.loadCulturesInNode('languages');
if (inNodejsRuntime()) {
//Todo: Rename the folder in 2.0.0
numbro.loadCulturesInNode();
}

// CommonJS module is defined
if (hasModule) {
Expand Down
Loading

0 comments on commit 38cc4de

Please sign in to comment.