Skip to content

Commit

Permalink
add aliases to Wh unit and kilo prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron Glasenapp committed Sep 2, 2015
1 parent 6d72047 commit 2c5343d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 8 additions & 0 deletions spec/quantitiesSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,14 @@ describe("js-quantities", function() {
expect(qty.denominator).toEqual(["<second>","<second>","<joule>","<joule>","<joule>"]);
});

it("should create watthour units", function() {
var qty = Qty("1 KWH");
expect(qty.scalar).toBe(1);
expect(qty.baseScalar).toBe(3600000)
expect(qty.numerator).toEqual(["<kilo>", "<Wh>"]);
expect(qty.denominator).toEqual(["<1>"])
});

it("should create with zero power", function() {
var qty = Qty("1 m^0");
expect(qty.scalar).toBe(1);
Expand Down
4 changes: 2 additions & 2 deletions src/quantities.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
"<tera>" : [["T","Tera","tera"], 1e12, "prefix"],
"<giga>" : [["G","Giga","giga"], 1e9, "prefix"],
"<mega>" : [["M","Mega","mega"], 1e6, "prefix"],
"<kilo>" : [["k","kilo"], 1e3, "prefix"],
"<kilo>" : [["k","K","kilo"], 1e3, "prefix"],
"<hecto>" : [["h","Hecto","hecto"], 1e2, "prefix"],
"<deca>" : [["da","Deca","deca","deka"], 1e1, "prefix"],
"<deci>" : [["d","Deci","deci"], 1e-1, "prefix"],
Expand Down Expand Up @@ -214,7 +214,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
"<calorie>" : [["cal","calorie","calories"], 4.18400, "energy",["<meter>","<meter>","<kilogram>"], ["<second>","<second>"]],
"<Calorie>" : [["Cal","Calorie","Calories"], 4184.00, "energy",["<meter>","<meter>","<kilogram>"], ["<second>","<second>"]],
"<therm-US>" : [["th","therm","therms","Therm"], 105480400, "energy",["<meter>","<meter>","<kilogram>"], ["<second>","<second>"]],
"<Wh>" : [["Wh"], 3600, "energy",["<meter>","<meter>","<kilogram>"], ["<second>","<second>"]],
"<Wh>" : [["Wh", "WH", "wh"], 3600, "energy",["<meter>","<meter>","<kilogram>"], ["<second>","<second>"]],

/* force */
"<newton>" : [["N","Newton","newton"], 1.0, "force", ["<kilogram>","<meter>"], ["<second>","<second>"]],
Expand Down

0 comments on commit 2c5343d

Please sign in to comment.