Files
BitwiseCmd/src.old/js/core/is.js
Borys_Levytskyi de0dfba04f React boilerplate
2016-11-20 18:59:57 +02:00

38 lines
868 B
JavaScript

(function(){
"use strict";
window.core.is = {
plainObject: function(obj) {
return typeof obj == "object" && obj instanceof Object;
},
aFunction: function (obj) {
return typeof obj == "function";
},
string: function (obj) {
return typeof obj == "string";
},
regex: function (obj) {
return typeof obj == "object" && this.constructedFrom(RegExp);
},
constructedFrom: function (obj, ctor) {
return obj instanceof ctor;
},
htmlElement: function(obj) {
return obj instanceof HtmlElement;
},
array: function(obj) {
return obj instanceof Array;
},
number: function(num) {
return typeof num == "number" && !isNaN(num)
}
};
})();