head - nodef/extra-map GitHub Wiki

Get first entry from map (default order).

Similar: head, tail.

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

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

var x = new Map();
map.head(x);
// → []

References