From 965b88d5e2495189e9d0bc0fe06ad5b3f860fe12 Mon Sep 17 00:00:00 2001 From: Aaron Glasenapp Date: Wed, 2 Sep 2015 11:18:04 -0600 Subject: [PATCH] add aliases to Wh unit and kilo prefix --- spec/quantitiesSpec.js | 8 ++++++++ src/quantities.js | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/spec/quantitiesSpec.js b/spec/quantitiesSpec.js index 683afa9..486f4d2 100644 --- a/spec/quantitiesSpec.js +++ b/spec/quantitiesSpec.js @@ -154,6 +154,14 @@ describe("js-quantities", function() { expect(qty.denominator).toEqual(["","","","",""]); }); + it("should create kilowatt hour units", function() { + var qty = Qty("1 KWH"); + expect(qty.scalar).toBe(1); + expect(qty.baseScalar).toBe(3600000) + expect(qty.numerator).toEqual(["", ""]); + expect(qty.denominator).toEqual(["<1>"]) + }); + it("should create with zero power", function() { var qty = Qty("1 m^0"); expect(qty.scalar).toBe(1); diff --git a/src/quantities.js b/src/quantities.js index ce1d4db..e4083ff 100644 --- a/src/quantities.js +++ b/src/quantities.js @@ -46,7 +46,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI "" : [["T","Tera","tera"], 1e12, "prefix"], "" : [["G","Giga","giga"], 1e9, "prefix"], "" : [["M","Mega","mega"], 1e6, "prefix"], - "" : [["k","kilo"], 1e3, "prefix"], + "" : [["k","K","kilo"], 1e3, "prefix"], "" : [["h","Hecto","hecto"], 1e2, "prefix"], "" : [["da","Deca","deca","deka"], 1e1, "prefix"], "" : [["d","Deci","deci"], 1e-1, "prefix"], @@ -214,7 +214,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI "" : [["cal","calorie","calories"], 4.18400, "energy",["","",""], ["",""]], "" : [["Cal","Calorie","Calories"], 4184.00, "energy",["","",""], ["",""]], "" : [["th","therm","therms","Therm"], 105480400, "energy",["","",""], ["",""]], - "" : [["Wh"], 3600, "energy",["","",""], ["",""]], + "" : [["Wh", "WH", "wh"], 3600, "energy",["","",""], ["",""]], /* force */ "" : [["N","Newton","newton"], 1.0, "force", ["",""], ["",""]],