head - nodef/extra-lists GitHub Wiki

Get first entry from lists (default order).

Similar: head, tail.

function head(x, ed)
// x:  lists
// ed: default entry
const xlists = require('extra-lists');

var x = ['a', 'b', 'c'], [1, 2, 3](/nodef/extra-lists/wiki/'a',-'b',-'c'],-[1,-2,-3);
xlists.head(x);
// → [ 'a', 1 ]

var x = [], [](/nodef/extra-lists/wiki/],-[);
xlists.head(x, ['', -1]);
// → [ '', -1 ]

References