Like Symbol.hasInstance but for the "in" operator.
This symbol would work for both native and user-defined objects.
**Example implementation** prototyping native object:
```js
String.prototype[Symbol.inObject] =
function(searchString) {
return this.includes(searchString)
}
```
**Example implementation* *for user-defined object:
```js
function range(min, max) => ({
[Symbol.inObject]: (prop) => {
return (prop >= min && prop <= max)
}
})
```
**Example usage**:
```js
("foo" in "food") // true
(14 in range(1, 25)) // true
```
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss