it-last
Returns the last result from an async iterator
Last updated 8 months ago by GitHub Actions .
Apache-2.0 OR MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install it-last 
SYNC missed versions from official npm registry.

it-last

codecov CI

Returns the last result from an async iterator

About

Return the last value from an (async)iterable.

Example

import last from 'it-last'

// This can also be an iterator, generator, etc
const values = [0, 1, 2, 3, 4]

const res = last(values)

console.info(res) // 4

Async sources must be awaited:

import last from 'it-last'

const values = async function * () {
  yield * [0, 1, 2, 3, 4]
}

const res = await last(values())

console.info(res) // 4

Install

$ npm i it-last

Browser <script> tag

Loading this module through a script tag will make its exports available as ItLast in the global namespace.

<script src="https://unpkg.com/it-last/dist/index.min.js"></script>

API Docs

License

Licensed under either of

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Current Tags

  • 3.0.11                                ...           latest (8 months ago)

21 Versions

  • 3.0.11                                ...           8 months ago
  • 3.0.10                                ...           8 months ago
  • 3.0.9                                ...           a year ago
  • 3.0.8                                ...           2 years ago
  • 3.0.7                                ...           2 years ago
  • 3.0.6                                ...           3 years ago
  • 3.0.5                                ...           3 years ago
  • 3.0.4                                ...           3 years ago
  • 3.0.3                                ...           3 years ago
  • 3.0.2                                ...           4 years ago
  • 3.0.1                                ...           4 years ago
  • 3.0.0                                ...           4 years ago
  • 2.0.1                                ...           4 years ago
  • 2.0.0                                ...           4 years ago
  • 1.0.6                                ...           5 years ago
  • 1.0.5                                ...           6 years ago
  • 1.0.4                                ...           6 years ago
  • 1.0.3                                ...           6 years ago
  • 1.0.2                                ...           7 years ago
  • 1.0.1                                ...           7 years ago
  • 1.0.0                                ...           7 years ago
Maintainers (1)
Downloads
Total 53
Today 0
This Week 9
This Month 40
Last Day 4
Last Week 10
Last Month 6
Dependencies (0)
None
Dev Dependencies (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE