private sequenceEqual()

in src/dataViewBuilder/matrixBuilder.ts [258:284]


    private sequenceEqual<T, U>(left: T[], right: U[], comparison: (x: T, y: U) => boolean): boolean {

        // Normalize falsy to null
        if (!left) { left = null; }
        if (!right) { right = null; }

        // T can be same as U, and it is possible for left and right to be the same array object...
        if (left === <any[]>right) {
            return true;
        }

        if (!!left !== !!right) {
            return false;
        }

        let len = left.length;
        if (len !== right.length) {
            return false;
        }

        let i = 0;
        while (i < len && comparison(left[i], right[i])) {
            ++i;
        }

        return i === len;
    }