Skip to content

Instantly share code, notes, and snippets.

@texdc
Created March 12, 2016 15:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save texdc/5bfa308469ec45065af3 to your computer and use it in GitHub Desktop.
Save texdc/5bfa308469ec45065af3 to your computer and use it in GitHub Desktop.
"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