lib/runtime/values.js
function(a, b) {
        var self = this;

        function equalArrays(a, b) {
            if (a.length !== b.length) {
                return false;
            }

            var length = a.length;
            var i;
            for (i = 0; i < length; i++) {
                if (!self.equal(a[i], b[i])) {
                    return false;
                }
            }

            return true;
        }

        function equalObjects(a, b) {
            var keysA = Object.keys(a);
            var keysB = Object.keys(b);

            keysA.sort();
            keysB.sort();

            if (keysA.length !== keysB.length) {
                return false;
            }

            var length = keysA.length;
            var i;
            var key;
            for (i = 0; i < length; i++) {
                if (keysA[i] !== keysB[i]) {
                    return false;
                }

                key = keysA[i];
                if (!self.equal(a[key], b[key])) {
                    return false;
                }
            }

            return true;
        }

        var typeA = this.typeOf(a);
        var typeB = this.typeOf(b);

        if (typeA !== typeB) {
            return false;
        }

        switch (typeA) {
            case 'Null':
            case 'Boolean':
            case 'Number':
            case 'String':
            case 'Filter':
                return a === b;

            case 'RegExp':
                return a.source === b.source
                    && a.global === b.global
                    && a.multiline === b.multiline
                    && a.ignoreCase === b.ignoreCase;

            case 'Date':
            case 'Duration':
                return JuttleMoment.eq(a, b);

            case 'Array':
                return equalArrays(a, b);

            case 'Object':
                return equalObjects(a, b);
        }
    }
function(a, b) {
        var self = this;

        function equalArrays(a, b) {
            if (a.length !== b.length) {
                return false;
            }

            var length = a.length;
            var i;
            for (i = 0; i < length; i++) {
                if (!self.equal(a[i], b[i])) {
                    return false;
                }
            }

            return true;
        }

        function equalObjects(a, b) {
            var keysA = Object.keys(a);
            var keysB = Object.keys(b);

            keysA.sort();
            keysB.sort();

            if (keysA.length !== keysB.length) {
                return false;
            }

            var length = keysA.length;
            var i;
            var key;
            for (i = 0; i < length; i++) {
                if (keysA[i] !== keysB[i]) {
                    return false;
                }

                key = keysA[i];
                if (!self.equal(a[key], b[key])) {
                    return false;
                }
            }

            return true;
        }

        var typeA = this.typeOf(a);
        var typeB = this.typeOf(b);

        if (typeA !== typeB) {
            return false;
        }

        switch (typeA) {
            case 'Null':
            case 'Boolean':
            case 'Number':
            case 'String':
            case 'Filter':
                return a === b;

            case 'RegExp':
                return a.source === b.source
                    && a.global === b.global
                    && a.multiline === b.multiline
                    && a.ignoreCase === b.ignoreCase;

            case 'Date':
            case 'Duration':
                return JuttleMoment.eq(a, b);

            case 'Array':
                return equalArrays(a, b);

            case 'Object':
                return equalObjects(a, b);
        }
    }
function ( a , b ) { var self = this ; function equalArrays ( a , b ) { if ( a . length !== b . length ) { return false ; } var length = a . length ; var i ; for ( i = 0 ; i < length ; i ++ ) { if ( ! self . equal ( a [ i ] , b [ i ] ) ) { return false ; } } return true ; } function equalObjects ( a , b ) { var keysA = Object . keys ( a ) ; var keysB = Object . keys ( b ) ; keysA . sort ( ) ; keysB . sort ( ) ; if ( keysA . length !== keysB . length ) { return false ; } var length = keysA . length ; var i ; var key ; for ( i = 0 ; i < length ; i ++ ) { if ( keysA [ i ] !== keysB [ i ] ) { return false ; } key = keysA [ i ] ; if ( ! self . equal ( a [ key ] , b [ key ] ) ) { return false ; } } return true ; } var typeA = this . typeOf ( a ) ; var typeB = this . typeOf ( b ) ; if ( typeA !== typeB ) { return false ; } switch ( typeA ) { case 'Null' : case 'Boolean' : case 'Number' : case 'String' : case 'Filter' : return a === b ; case 'RegExp' : return a . source === b . source && a . global === b . global && a . multiline === b . multiline && a . ignoreCase === b . ignoreCase ; case 'Date' : case 'Duration' : return JuttleMoment . eq ( a , b ) ; case 'Array' : return equalArrays ( a , b ) ; case 'Object' : return equalObjects ( a , b ) ; } }
Determines whether two Juttle values are equal.
Determines whether two Juttle values are equal .