function listToObject(list, key) {
        var length, result, i, obj, keyValue;
        if (!list) {
            list = [];
        }
        length = list.length;
        result = { valids: {}, discarded: [] };
        for (i = 0; i < length; i += 1) {
            obj = list[i];
            keyValue = obj[key];
            // discard the object without a key
            if (keyValue) {
                result.valids[keyValue] = obj;
            } else {
                result.discarded.push(obj);
            }
        }
        return result;
    }
/**
     * Convert a list to an object using the given key name
     */
Convert a list to an object using the given key name
Convert a list to an object using the given key name
function listToObject(list, key) {
        var length, result, i, obj, keyValue;
        if (!list) {
            list = [];
        }
        length = list.length;
        result = { valids: {}, discarded: [] };
        for (i = 0; i < length; i += 1) {
            obj = list[i];
            keyValue = obj[key];
            if (keyValue) {
                result.valids[keyValue] = obj;
            } else {
                result.discarded.push(obj);
            }
        }
        return result;
    }
function listToObject ( list , key ) { var length , result , i , obj , keyValue ; if ( ! list ) { list = [ ] ; } length = list . length ; result = { valids : { } , discarded : [ ] } ; for ( i = 0 ; i < length ; i += 1 ) { obj = list [ i ] ; keyValue = obj [ key ] ; if ( keyValue ) { result . valids [ keyValue ] = obj ; } else { result . discarded . push ( obj ) ; } } return result ; }
Convert a list to an object using the given key name
Convert a list to an object using the given key name
// discard the object without a key