Skip to content
Subhajit Sahu edited this page Dec 22, 2022 · 14 revisions

Get first value.

Similar: head, tail.


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

var x = [["a", 1], ["b", 2], ["c", 3]];
entries.head(x);
// → [ "a", 1 ]

var x = [];
entries.head(x, ["", -1]);
// → [ "", -1 ]


References

Clone this wiki locally