build_brands.js
function buildReverseIndex(obj) {
    let warnCollisions = [];

    for (let k in obj) {
        checkAmbiguous(k);

        if (obj[k].match) {
            for (let i = obj[k].match.length - 1; i >= 0; i--) {
                let match = obj[k].match[i];
                checkAmbiguous(match);

                if (rIndex[match]) {
                    warnCollisions.push([rIndex[match], match]);
                    warnCollisions.push([k, match]);
                }
                rIndex[match] = k;
            }
        }
    }

    if (warnCollisions.length) {
        console.warn(colors.yellow('\nWarning - match name collisions'));
        console.warn('To resolve these, make sure multiple entries do not contain the same "match" property.');
        warnCollisions.forEach(w => console.warn(
            colors.yellow('  "' + w[0] + '"') + ' -> match? -> ' + colors.yellow('"' + w[1] + '"')
        ));
    }
}
function buildReverseIndex(obj) {
    let warnCollisions = [];

    for (let k in obj) {
        checkAmbiguous(k);

        if (obj[k].match) {
            for (let i = obj[k].match.length - 1; i >= 0; i--) {
                let match = obj[k].match[i];
                checkAmbiguous(match);

                if (rIndex[match]) {
                    warnCollisions.push([rIndex[match], match]);
                    warnCollisions.push([k, match]);
                }
                rIndex[match] = k;
            }
        }
    }

    if (warnCollisions.length) {
        console.warn(colors.yellow('\nWarning - match name collisions'));
        console.warn('To resolve these, make sure multiple entries do not contain the same "match" property.');
        warnCollisions.forEach(w => console.warn(
            colors.yellow('  "' + w[0] + '"') + ' -> match? -> ' + colors.yellow('"' + w[1] + '"')
        ));
    }
}
function buildReverseIndex ( obj ) { let warnCollisions = [ ] ; for ( let k in obj ) { checkAmbiguous ( k ) ; if ( obj [ k ] . match ) { for ( let i = obj [ k ] . match . length - 1 ; i >= 0 ; i -- ) { let match = obj [ k ] . match [ i ] ; checkAmbiguous ( match ) ; if ( rIndex [ match ] ) { warnCollisions . push ( [ rIndex [ match ] , match ] ) ; warnCollisions . push ( [ k , match ] ) ; } rIndex [ match ] = k ; } } } if ( warnCollisions . length ) { console . warn ( colors . yellow ( '\nWarning - match name collisions' ) ) ; console . warn ( 'To resolve these, make sure multiple entries do not contain the same "match" property.' ) ; warnCollisions . forEach ( w => console . warn ( colors . yellow ( '  "' + w [ 0 ] + '"' ) + ' -> match? -> ' + colors . yellow ( '"' + w [ 1 ] + '"' ) ) ) ; } }
Returns a reverse index to map match keys back to their original keys
Returns a reverse index to map match keys back to their original keys