module.exports = {

    // toBeCloseTo... but for arrays
    toBeCloseToArray: function() {
        return {
            compare: function(actual, expected, precision) {
                if(precision !== 0) {
                    precision = Math.pow(10, -precision) / 2 || 0.005;
                }

                var tested = actual.map(function(element, i) {
                    return Math.abs(expected[i] - element) < precision;
                });

                var passed = (
                    expected.length === actual.length &&
                    tested.indexOf(false) < 0
                );

                return {
                    pass: passed,
                    message: 'Expected ' + actual + ' to be close to ' + expected + '.'
                };
            }
        };
    }
};

@@ -183,11 +183,8 @@
     
-if(
 prec
@@ -193,105 +193,36 @@
 ion 
-!== 0) %7B%0A                    precision = Math.pow(10, -precision) / 2 %7C%7C 0.005;%0A                %7D
+= coercePosition(precision);
 %0A%0A  
@@ -729,8 +729,1603 @@
    %7D
+,%0A%0A    // toBeCloseTo... but for 2D arrays%0A    toBeCloseTo2DArray: function() %7B%0A        return %7B%0A            compare: function(actual, expected, precision) %7B%0A                precision = coercePosition(precision);%0A%0A                var passed = true;%0A%0A                if(expected.length !== actual.length) passed = false;%0A                else %7B%0A                    for(var i = 0; i %3C expected.length; ++i) %7B%0A                        if(expected%5Bi%5D.length !== actual%5Bi%5D.length) %7B%0A                            passed = false;%0A                            break;%0A                        %7D%0A%0A                        for(var j = 0; j %3C expected%5Bi%5D.length; ++j) %7B%0A                            var isClose = Math.abs(expected%5Bi%5D%5Bj%5D - actual%5Bi%5D%5Bj%5D) %3C precision;%0A%0A                            if(!isClose) %7B%0A                                passed = false;%0A                                break;%0A                            %7D%0A                        %7D%0A                    %7D%0A                %7D%0A%0A                var message = %5B%0A                    'Expected',%0A                    arrayToStr(actual.map(arrayToStr)),%0A                    'to be close to',%0A                    arrayToStr(expected.map(arrayToStr))%0A                %5D.join(' ');%0A%0A                return %7B%0A                    pass: passed,%0A                    message: message%0A                %7D;%0A            %7D%0A        %7D;%0A    %7D,%0A%7D;%0A%0Afunction coercePosition(precision) %7B%0A    if(precision !== 0) %7B%0A        precision = Math.pow(10, -precision) / 2 %7C%7C 0.005;%0A    %7D%0A%0A    return precision;%0A%7D%0A%0Afunction arrayToStr(array) %7B%0A    return '%5B ' + array.join(', ') + ' %5D';
 %0A%7D
-;
 %0A

add toCloseTo2DArray custom matcher