mirror of
https://github.com/BorysLevytskyi/BitwiseCmd.git
synced 2025-12-23 13:12:42 +01:00
React boilerplate
This commit is contained in:
37
src.old/js/core/is.js
Normal file
37
src.old/js/core/is.js
Normal file
@@ -0,0 +1,37 @@
|
||||
(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)
|
||||
}
|
||||
};
|
||||
})();
|
||||
Reference in New Issue
Block a user