Skip to content

Commit

Permalink
Using formatted output [#150589657]
Browse files Browse the repository at this point in the history
  • Loading branch information
cannawen committed Sep 20, 2017
1 parent ed707d1 commit 6920efc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/conversion_helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,8 @@ function formatConversion(conversions) {
if (postprocessInput) {
conversion['imperial']['number'] = postprocessInput(imperialNumber);
conversion['imperial']['unit'] = "";
} else {
conversion['imperial']['number'] = rh.addCommas(imperialNumber);
}

return conversion;
Expand Down
2 changes: 1 addition & 1 deletion src/converter.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function conversions(comment) {

return formattedConversions.reduce((memo, conversion) => {
const key = conversion['imperial']['number'] + conversion['imperial']['unit'];
const value = conversion['rounded']['number'] + conversion['rounded']['unit'];
const value = conversion['formatted']['number'] + conversion['formatted']['unit'];

memo[key] = value ;
return memo;
Expand Down
4 changes: 2 additions & 2 deletions test/converter-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ describe('Converter', () => {
it('should convert', () => {
testConvert(
[
"1 lb"
"1001 lb"
],
{
"1 lb" : "0.45 kg"
"1,001 lb" : "450 kg"
}
);
});
Expand Down

0 comments on commit 6920efc

Please sign in to comment.