dist/lib/jasmineMatchers.js
function prettifyDiffObj(diff) {
    const obj = {
        kind: undefined,
        path: undefined,
        expect: undefined,
        actual: undefined,
        index: undefined,
        item: undefined,
    };
    if (diff.kind) {
        switch (diff.kind) {
            case 'N':
                obj.kind = 'New';
                break;
            case 'D':
                obj.kind = 'Missing';
                break;
            case 'E':
                obj.kind = 'Changed';
                break;
            case 'A':
                obj.kind = 'Array Canged';
                break;
        }
    }
    if (diff.path) {
        let path = diff.path[0];
        for (let i = 1; i < diff.path.length; i++) {
            path += `/${diff.path[i]}`;
        }
        obj.path = path;
    }
    if (typeof diff.lhs !== 'undefined') {
        obj.expect = diff.lhs;
    }
    if (typeof diff.rhs !== 'undefined') {
        obj.actual = diff.rhs;
    }
    if (diff.index) {
        obj.index = diff.index;
    }
    if (diff.item) {
        obj.item = prettifyDiffObj(diff.item);
    }
    return obj;
}
function prettifyDiffObj(diff) {
    const obj = {
        kind: undefined,
        path: undefined,
        expect: undefined,
        actual: undefined,
        index: undefined,
        item: undefined,
    };
    if (diff.kind) {
        switch (diff.kind) {
            case 'N':
                obj.kind = 'New';
                break;
            case 'D':
                obj.kind = 'Missing';
                break;
            case 'E':
                obj.kind = 'Changed';
                break;
            case 'A':
                obj.kind = 'Array Canged';
                break;
        }
    }
    if (diff.path) {
        let path = diff.path[0];
        for (let i = 1; i < diff.path.length; i++) {
            path += `/${diff.path[i]}`;
        }
        obj.path = path;
    }
    if (typeof diff.lhs !== 'undefined') {
        obj.expect = diff.lhs;
    }
    if (typeof diff.rhs !== 'undefined') {
        obj.actual = diff.rhs;
    }
    if (diff.index) {
        obj.index = diff.index;
    }
    if (diff.item) {
        obj.item = prettifyDiffObj(diff.item);
    }
    return obj;
}
function prettifyDiffObj ( diff ) { const obj = { kind : undefined , path : undefined , expect : undefined , actual : undefined , index : undefined , item : undefined , } ; if ( diff . kind ) { switch ( diff . kind ) { case 'N' : obj . kind = 'New' ; break ; case 'D' : obj . kind = 'Missing' ; break ; case 'E' : obj . kind = 'Changed' ; break ; case 'A' : obj . kind = 'Array Canged' ; break ; } } if ( diff . path ) { let path = diff . path [ 0 ] ; for ( let i = 1 ; i < diff . path . length ; i ++ ) { path += ` ${ diff . path [ i ] } ` ; } obj . path = path ; } if ( typeof diff . lhs !== 'undefined' ) { obj . expect = diff . lhs ; } if ( typeof diff . rhs !== 'undefined' ) { obj . actual = diff . rhs ; } if ( diff . index ) { obj . index = diff . index ; } if ( diff . item ) { obj . item = prettifyDiffObj ( diff . item ) ; } return obj ; }
DEFINE INTERNAL UTILITY FUNCTIONS BELOW makes output of a single diff more readable
DEFINE INTERNAL UTILITY FUNCTIONS BELOW makes output of a single diff more readable