### function toLookup(key, data) > #### Parameters > * **key** > * (String) Key to match on all objects. If key is undefined or null, the index will be used instead. > * **data** > * (Array) Array to create map from > > #### Return value > * (Object) Each key in the object will be the value in the Array specified by 'key' > > #### Description > This takes an Array and returns a reference map for quick lookup. > > #### See Also > * evisit-core-js.data.extract > > #### Examples > ```javascript > var myMap = toLookup('id', [ > { > id:'derp', > field: 'derp' > }, > { > id:'dog', > field: 'dog' > }, > { > id:'cat', > field: 'cat' > } > ]); > myMap === { > 'derp': { > id:'derp', > field: 'derp' > }, > 'dog': { > id:'dog', > field: 'dog' > }, > 'cat': { > id:'cat', > field: 'cat' > } > }; > ``` > > ---