Skip to content

Instantly share code, notes, and snippets.

@d4rkr00t
Created October 21, 2013 11:53
Show Gist options
  • Save d4rkr00t/7082646 to your computer and use it in GitHub Desktop.
Save d4rkr00t/7082646 to your computer and use it in GitHub Desktop.
JavaScript - Module Template
MYAPP.utilities.array = (function() {
var uobj = MYAPP.utilities.object,
ulang = MYAPP.utilities.lang,
array_string = "[object Array]",
ops = Object.prototype.toString;
return {
inArray: function(needle, haystack) {
for (var i = 0, max = haystack.length; i < max; i += 1) {
if (haystack[i] === needle) {
return true;
}
}
},
isArray: function(a) {
return ops.call(a) === array_string;
}
};
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment