diff --git a/lib/util.js b/lib/util.js index 83923ffb..ba551c2e 100644 --- a/lib/util.js +++ b/lib/util.js @@ -144,6 +144,22 @@ } }; + /** + * Check is type of arg with name is equal to type + * + * @param name + * @param arg + * @param type + */ + this.checkType = function(name, arg, type) { + var is = Util.getType(arg) === type; + + if (!is) + throw(Error(name + ' should be ' + type)); + + return this; + }; + /** * Check is Properties exists and they are true if neaded *