Add is.enumCase and assert.enumCase (#150)

Co-authored-by: Sindre Sorhus <sindresorhus@gmail.com>
This commit is contained in:
Olivier Beaulieu 2022-01-17 00:55:40 -05:00 committed by GitHub
parent f5cc764e22
commit a5b4017d5e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 39 additions and 0 deletions

View file

@ -212,6 +212,25 @@ is.boundFunction(function () {});
##### .sharedArrayBuffer(value)
##### .dataView(value)
##### .enumCase(value, enum)
**TypeScript-only**
Returns `true` if `value` is a member of `enum`.
```ts
enum Direction {
Ascending = 'ascending',
Descending = 'descending'
}
is.enumCase('ascending', Direction);
//=> true
is.enumCase('other', Direction);
//=> false
```
#### Emptiness
##### .emptyString(value)