@cowprotocol/cow-sdk
Version:
<p align="center"> <img width="400" src="https://github.com/cowprotocol/cow-sdk/raw/main/docs/images/CoW.png" /> </p>
27 lines (16 loc) • 836 B
Markdown
# it-first
[](https://github.com/achingbrain/it/actions/workflows/test.yml) [](https://coveralls.io/github/achingbrain/it?branch=master) [](https://david-dm.org/achingbrain/it?path=packages/it-first)
> Returns the first result from an (async) iterable.
Mostly useful for tests.
## Install
```sh
$ npm install --save it-first
```
## Usage
```javascript
const first = require('it-first')
// This can also be an iterator, async iterator, generator, etc
const values = [0, 1, 2, 3, 4]
const res = await first(values)
console.info(res) // 0
```