source/node/ArchiveComparator.js
function calculateCommonRecentCommand(archiveA, archiveB) {
    var historyA = archiveA._getWestley().getHistory(),
        historyB = archiveB._getWestley().getHistory(),
        aLen = historyA.length,
        bLen = historyB.length,
        a,
        b;
    for (a = aLen - 1; a >= 0; a -= 1) {
        if (getCommandType(historyA[a]) === "pad") {
            var paddingA = getPaddingID(historyA[a]);
            for (b = bLen - 1; b >= 0; b -= 1) {
                if (getCommandType(historyB[b]) === "pad" && getPaddingID(historyB[b]) === paddingA) {
                    return {
                        a: a,
                        b: b,
                        historyA: historyA,
                        historyB: historyB
                    };
                }
            }
        }
    }
    return false;
}
function calculateCommonRecentCommand(archiveA, archiveB) {
    var historyA = archiveA._getWestley().getHistory(),
        historyB = archiveB._getWestley().getHistory(),
        aLen = historyA.length,
        bLen = historyB.length,
        a,
        b;
    for (a = aLen - 1; a >= 0; a -= 1) {
        if (getCommandType(historyA[a]) === "pad") {
            var paddingA = getPaddingID(historyA[a]);
            for (b = bLen - 1; b >= 0; b -= 1) {
                if (getCommandType(historyB[b]) === "pad" && getPaddingID(historyB[b]) === paddingA) {
                    return {
                        a: a,
                        b: b,
                        historyA: historyA,
                        historyB: historyB
                    };
                }
            }
        }
    }
    return false;
}
function calculateCommonRecentCommand ( archiveA , archiveB ) { var historyA = archiveA . _getWestley ( ) . getHistory ( ) , historyB = archiveB . _getWestley ( ) . getHistory ( ) , aLen = historyA . length , bLen = historyB . length , a , b ; for ( a = aLen - 1 ; a >= 0 ; a -= 1 ) { if ( getCommandType ( historyA [ a ] ) === "pad" ) { var paddingA = getPaddingID ( historyA [ a ] ) ; for ( b = bLen - 1 ; b >= 0 ; b -= 1 ) { if ( getCommandType ( historyB [ b ] ) === "pad" && getPaddingID ( historyB [ b ] ) === paddingA ) { return { a : a , b : b , historyA : historyA , historyB : historyB } ; } } } } return false ; }
Calculate the common command indexes between 2 archives.
The common index is where a padding ID matches that of the other archive,
at some point. If we assume one archive may have been flattened, we cannot
assume that the entire past history of the archives will be the same, but
we can assume that at that point, the archives produce the same structure.
Because the archives may be different in the future, we use the newest
matching pad ID to create a common link between the 2 histories.
@param {Archive} archiveA The original archive
@param {Archive} archiveB The secondary archive
@returns {Boolean|{ a: Number, b: Number, historyA: Array, historyB: Array }} Returns
false if no common point, or an object with the common information. `a` and `b`
are the indexes where the common padding occurs, and historyA and historyB are
the history arrays for the archives.
@private
@static
@memberof ArchiveComparator
Calculate the common command indexes between 2 archives . The common index is where a padding ID matches that of the other archive at some point . If we assume one archive may have been flattened we cannot assume that the entire past history of the archives will be the same but we can assume that at that point the archives produce the same structure . Because the archives may be different in the future we use the newest matching pad ID to create a common link between the 2 histories .