Skip to content
Subhajit Sahu edited this page Feb 3, 2021 · 19 revisions

Get first value.

Similar: head, tail, init, last.


function head(x, vd?)
// x:  an iterable
// vd: default value
const xiterable = require('extra-iterable');

xiterable.head([1, 2, 3]);
// → 1

xiterable.head([], -1);
// → -1


References

Clone this wiki locally