mapKeySet

mapKeySet(map map) → set keys
Returns a new set containing the keys of the map map, in the order of the map. Same as arrayToSet(mapKeys(map)), without the intermediate array. Modifying the set does not modify the map.

This function is available from LeekScript 4 onward. Returns a new set containing the keys of the map map, in the order of the map.

Same as arrayToSet(mapKeys(map)), without the intermediate array. The set is a copy: modifying it does not modify the map.

var hp = [12: 500, 15: 320, 18: 0]
var ids = mapKeySet(hp)
debug(ids) // <12, 15, 18>
debug(15 in ids) // true
const hp = new Map([ [12, 500], [15, 320], [18, 0] ])
const ids = new Set(hp.keys())
Debug.log([...ids]) // [12, 15, 18]
hp = {12: 500, 15: 320, 18: 0}
ids = set(hp.keys())
Debug.log(sorted(ids)) # [12, 15, 18]
Parameters
Return
Note