mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-20 18:18:56 +00:00
feature(util) add checkType
This commit is contained in:
parent
bfff1224e0
commit
fb8371d0cd
1 changed files with 16 additions and 0 deletions
16
lib/util.js
16
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
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue