https://github.com/lamansky/is-iterable-with
Checks if a value is an iterable that outputs exactly the specified values.
https://github.com/lamansky/is-iterable-with
Last synced: 3 months ago
JSON representation
Checks if a value is an iterable that outputs exactly the specified values.
- Host: GitHub
- URL: https://github.com/lamansky/is-iterable-with
- Owner: lamansky
- License: mit
- Created: 2018-08-22T12:58:46.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-08-22T13:01:46.000Z (almost 8 years ago)
- Last Synced: 2025-03-18T01:37:33.811Z (over 1 year ago)
- Language: JavaScript
- Size: 1.95 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license.txt
Awesome Lists containing this project
README
# is-iterable-with
Checks if a value is an iterable that outputs exactly the specified values.
## Installation
Requires [Node.js](https://nodejs.org/) 6.0.0 or above.
```bash
npm i is-iterable-with
```
## API
The module exports a single function.
### Parameters
1. Bindable: `iterable` (any): The value that should be an iterable.
2. Variadic: `...values`: The values that should be iterated.
### Return Value
Returns `true` if `iterable` is an iterable and if its outputted values exactly equal the `values` arguments. Otherwise `false`.
## Example
```javascript
const isIterableWith = require('is-iterable-with')
const arr = [1, 2, 3]
isIterableWith(arr, 1, 2, 3) // true
isIterableWith(123) // false
isIterableWith(arr, 1, 2) // false
isIterableWith(arr, 1, 2, 3, 4) // false
isIterableWith(arr, 2, 1, 3) // false
// Supports the bind operator
arr::isIterableWith(1, 2, 3) // true
```
## Related
* [is-array-with](https://github.com/lamansky/is-array-with)