Handle the missing second argument to isunit() with an appropriate error message.

This commit is contained in:
Anton Muraviev
2014-12-07 12:45:50 +00:00
parent 56b739c153
commit ab8deae516

View File

@@ -11,6 +11,9 @@ var isa = function (n, Type) {
return (n instanceof Type) ? Keyword.True : Keyword.False;
},
isunit = function (n, unit) {
if (unit === undefined) {
throw { type: "Argument", message: "missing the required second argument to isunit." };
}
return (n instanceof Dimension) && n.unit.is(unit.value !== undefined ? unit.value : unit) ? Keyword.True : Keyword.False;
};
functionRegistry.addMultiple({