Created
March 12, 2016 15:14
-
-
Save texdc/5bfa308469ec45065af3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict" | |
var Util = Object.create({}, { | |
isDefined: { value: function(aValue) { | |
return !this.isUndefined(aValue); | |
}}, | |
isUndefined: { value: function(aValue) { | |
return (aValue === undefined); | |
}}, | |
isA: { value: function(aValue, aType) { | |
return (aValue instanceof aType); | |
}}, | |
isString: { value: function(aValue) { | |
return (typeof aValue === 'string'); | |
}}, | |
isNumber: { value: function(aValue) { | |
return (typeof aValue === 'number'); | |
}}, | |
isObject: { value: function(aValue) { | |
return this.isA(aValue, Object); | |
}}, | |
isArray: { value: function(aValue) { | |
return Array.isArray(aValue); | |
}}, | |
inArray: { value: function(aValue, anArray) { | |
if (this.isArray(anArray)) { | |
return anArray.some(value => value == aValue); | |
} | |
return false; | |
}} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment