Assuming we don't do what I want to do which is to implement Array.prototype.has(), what is conventions for the following...
if (['contacts','calendar','tasks','inbox'].indexOf(kind)!==-1) {
What I don't like is the !==-1, but I also don't like the array.
I used to use a String.prototype.inList(list,<delimiter>) which would actually compute the delimiter if not provided.
Forgive me for bemoaning the collision of zero-based arrays and truthiness. Is there some sneaky way of doing this without indexOf and !==-1, I suppose I could say indexOf(kind)+1 to get the truthiness. What else?
EDIT:
To refine what I am looking for -- is a way to handle "is string in list", but in the literal way (quick, dirty, shorthand) and not so much in the way where list is an array, or in a variable like find.inList(list). I am open to prototype solutions, but am more curious about creative hacks like the ~'a b c'.split(' ').indexOf(abc). So maybe String.prototype.hasItem(find,<delimiter>) so that 'a b c'.hasItem(abc)
if (~[a,b,c].indexOf(d)), but how aboutif ([a,b,c].some(is(d)), whereis=x=>y=>x===yArray.prototype.includesexist which will return a boolean. So you don't have to use `.indexOf() !== -``. Polyfill: developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/…includes?? they must be givinggetElementsByTagNamea run for their money. I am surprised they didn't name itisContainingMemberLike