is-iterable-with
v1.0.0
Published
Checks if a value is an iterable that outputs exactly the specified values.
Downloads
9
Readme
is-iterable-with
Checks if a value is an iterable that outputs exactly the specified values.
Installation
Requires Node.js 6.0.0 or above.
npm i is-iterable-with
API
The module exports a single function.
Parameters
- Bindable:
iterable
(any): The value that should be an iterable. - 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
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