first-of-iterable
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

First of Iterable

Returns the first item of an iterable.

Installation

npm install --save first-of-iterable

Usage

const firstOfIterable = require('first-of-iterable')

console.log(firstOfIterable([]))
//=> undefined

console.log(firstOfIterable([1, 2, 3]))
//=> 1

API

firstOfIterable(iterable)

Return the first value of the iterable, or undefined if the iterable is empty.

Readme

Keywords

none

Package Sidebar

Install

npm i first-of-iterable

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

1.33 kB

Total Files

6

Last publish

Collaborators

  • linusu