jashkenas/coffee-script — Issue #2029: Negated Comprehensions
Author: meltingice
Created: 2012-01-12 03:48:29+00:00
State: open

It's very simple and well outlined how to check if a value exists in an array using comprehensions, but there is no pretty Coffeescript syntax (as far as I know) to check if a value **isn't** in an array.

So for example, to check for a value in an array we do:

``` coffeescript
something() if value in arrayData
```
which translates to (minus the helper functions):

``` js
if (__indexOf.call(arrayData, value) >= 0) something();
```

I propose, to check if a value is missing from an array, to add:

``` coffeescript
something() if value isnt in arrayData
```

which would translate to (again, minus the helper functions):

``` js
if (__indexOf.call(arrayData, value) === -1) something();
```