src/tools/general.js
function arrayToObject ( keyPath, arr ) {
    var res = {}, key, element;

    for ( var i = 0, len = arr.length; i < len; i++ ) {
        element = arr[ i ];
        key     = getOrNull( element, keyPath );
        if ( key ) res[ key ] = element;
    }
    
    return res;
}
function arrayToObject ( keyPath, arr ) {
    var res = {}, key, element;

    for ( var i = 0, len = arr.length; i < len; i++ ) {
        element = arr[ i ];
        key     = getOrNull( element, keyPath );
        if ( key ) res[ key ] = element;
    }
    
    return res;
}
function arrayToObject ( keyPath , arr ) { var res = { } , key , element ; for ( var i = 0 , len = arr . length ; i < len ; i ++ ) { element = arr [ i ] ; key = getOrNull ( element , keyPath ) ; if ( key ) res [ key ] = element ; } return res ; }
Converts array to object, using `keyPath`
for building unique keys.
@param {(String|Array)} keyPath - path to `key` value
in the array element.
@param {Object[]} - array to convert.
@return {Object}
Converts array to object using keyPath for building unique keys .