Open puiutucutu opened 4 years ago
/** * Creates an object where each string from the array of strings is the object * key set to some default value. * * @param {*} defaultValue * @return {function(xs: string[]): Object} * @example * * itemsToDict(null)(["a","b","c"]); //=> { a: null, b: null, c: null } * */ export const itemsToDict = defaultValue => xs => { return xs.reduce((acc, x) => ((acc[x] = defaultValue), acc), {}); };