Skip to content

Instantly share code, notes, and snippets.

@armw4
Last active January 3, 2016 15:59
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 armw4/8486809 to your computer and use it in GitHub Desktop.
Save armw4/8486809 to your computer and use it in GitHub Desktop.
Well...he wasn't satisfied...wanted to see it in JavaScript...sigh
var DANNY_ALIASES = ['Danny', 'D$', 'Dollarz', 'D Dollarz'];
// hwa? why isn't he using underscore or loadash? #STFUUUUUUU!!!!!
DANNY_ALIASES.include = function(item) {
var include = false;
for(var i = 0; i < this.length; i++) {
if (this[i] == item) {
include = true;
break;
}
}
return include;
};
// hwa? why doesn't he just use extend and mixin the functionality? #STFUUUUUUU!!!
// the answer to both your questions is because he DOESN'T WANT TO!!!
// LET'S ALL BE DIFFERENT...ON PURPOSE.......NOW!!!!!!
DANNY_ALIASES.forEach(function(item) {
item.eql = function(other) {
return DANNY_ALIASES.include(other) && DANNY_ALIASES.include(this);
};
});
for(var i = 0; i < DANNY_ALIASES.length; i++) {
var item = DANNY_ALIASES[i];
var nextItem = DANNY_ALIASES[i + 1];
if (nextItem) console.log('%s == %s', item, nextItem);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment