dist/diff.js
function(seq1, seq2, stepMap){
    // get contrast arrays (src & target) by analyze step by step
    var l1 = seq1.length,
        l2 = seq2.length,
        src = [], target = [];

    for(var i = l1,j = l2; i > 0 || j > 0;){
        switch(stepMap[i][j]){

        case STEP_NOCHANGE:
            src.unshift(seq1[i-1]);
            target.unshift(MARK_SAME);
            i -= 1;
            j -= 1;
            break;

        case STEP_REPLACE:
            src.unshift(seq1[i-1]);
            target.unshift(seq2[j-1]);
            i -= 1;
            j -= 1;
            break;

        case STEP_REMOVE:
            src.unshift(seq1[i-1]);
            target.unshift(MARK_EMPTY);
            i -= 1;
            j -= 0;
            break;

        case STEP_INSERT:
            src.unshift(MARK_EMPTY);
            target.unshift(seq2[j-1]);
            i -= 0;
            j -= 1;
            break;

        }
    }

    return {
        src: src,
        target: target
    };
}
function(seq1, seq2, stepMap){
    // get contrast arrays (src & target) by analyze step by step
    var l1 = seq1.length,
        l2 = seq2.length,
        src = [], target = [];

    for(var i = l1,j = l2; i > 0 || j > 0;){
        switch(stepMap[i][j]){

        case STEP_NOCHANGE:
            src.unshift(seq1[i-1]);
            target.unshift(MARK_SAME);
            i -= 1;
            j -= 1;
            break;

        case STEP_REPLACE:
            src.unshift(seq1[i-1]);
            target.unshift(seq2[j-1]);
            i -= 1;
            j -= 1;
            break;

        case STEP_REMOVE:
            src.unshift(seq1[i-1]);
            target.unshift(MARK_EMPTY);
            i -= 1;
            j -= 0;
            break;

        case STEP_INSERT:
            src.unshift(MARK_EMPTY);
            target.unshift(seq2[j-1]);
            i -= 0;
            j -= 1;
            break;

        }
    }

    return {
        src: src,
        target: target
    };
}
function ( seq1 , seq2 , stepMap ) { // get contrast arrays (src & target) by analyze step by step var l1 = seq1 . length , l2 = seq2 . length , src = [ ] , target = [ ] ; for ( var i = l1 , j = l2 ; i > 0 || j > 0 ; ) { switch ( stepMap [ i ] [ j ] ) { case STEP_NOCHANGE : src . unshift ( seq1 [ i - 1 ] ) ; target . unshift ( MARK_SAME ) ; i -= 1 ; j -= 1 ; break ; case STEP_REPLACE : src . unshift ( seq1 [ i - 1 ] ) ; target . unshift ( seq2 [ j - 1 ] ) ; i -= 1 ; j -= 1 ; break ; case STEP_REMOVE : src . unshift ( seq1 [ i - 1 ] ) ; target . unshift ( MARK_EMPTY ) ; i -= 1 ; j -= 0 ; break ; case STEP_INSERT : src . unshift ( MARK_EMPTY ) ; target . unshift ( seq2 [ j - 1 ] ) ; i -= 0 ; j -= 1 ; break ; } } return { src : src , target : target } ; }
stepMap to contrast array
stepMap to contrast array