Last active
January 3, 2016 15:59
-
-
Save armw4/8486809 to your computer and use it in GitHub Desktop.
Well...he wasn't satisfied...wanted to see it in JavaScript...sigh
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
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