UNPKG

array-to-set

Version:

JS function for turning an Array into a set (a plain JS object with keys pointing to true)

12 lines (8 loc) 215 B
"use strict" arrayToSet = (arr) -> """Takes a list of things and puts into an object so that testing for existence is faster""" set = {} for obj in arr set[obj] = true set module.exports = arrayToSet