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 ientries = require('extra-ientries');

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

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


References

Clone this wiki locally