Skip to content

Commit

Permalink
Merge branch 'pr/99' into develop
Browse files Browse the repository at this point in the history
Conflicts:
	min/numeral.min.js
  • Loading branch information
adamwdraper committed Oct 30, 2013
2 parents cb80270 + 5831367 commit fd2ea10
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
3 changes: 3 additions & 0 deletions numeral.js
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,9 @@
},

unformat : function (inputString) {
if (Object.prototype.toString.call(inputString) === '[object Number]') {
return inputString;
}
return unformatNumeral(this, inputString ? inputString : defaultFormat);
},

Expand Down
12 changes: 10 additions & 2 deletions tests/numeral/unformat.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ exports.unformat = {
},

numbers: function (test) {
test.expect(9);
test.expect(15);

var tests = [
['10,000.123', 10000.123],
Expand All @@ -18,7 +18,15 @@ exports.unformat = {
['1.23t', 1230000000000],
['N/A', 0],
[, 0],
['', 0]
['', 0],

// Pass Through for Numbers
[0, 0],
[1, 1],
[1.1, 1.1],
[-0, 0],
[-1, -1],
[-1.1, -1.1]
];

for (var i = 0; i < tests.length; i++) {
Expand Down

0 comments on commit fd2ea10

Please sign in to comment.