Node.js examples for Data Structure:Map
Takes an array, and turns it into the truth map
//takes an array, and turns it into the truth map (item[i] => true) Object.TruthMap = function ( props ) { return ( props || [] ).reduce( assignTrue, Object.create(null) ); function assignTrue ( ret, key ) { ret[ key ] = true;/*from w w w . j a v a2 s . c om*/ return ret; } };