Code coverage report for array/difference.js

Statements: 100% (8 / 8)      Branches: 100% (0 / 0)      Functions: 100% (5 / 5)      Lines: 100% (7 / 7)     

All files » array/ » difference.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 201           1 7   22 29     7     1      
define(['./unique', './filter', './some', './contains'], function (unique, filter, some, contains) {
 
 
    /**
     * Return a new Array with elements that aren't present in the other Arrays.
     */
    function difference(arr) {
        var arrs = Array.prototype.slice.call(arguments, 1),
            result = filter(unique(arr), function(needle){
                return !some(arrs, function(haystack){
                    return contains(haystack, needle);
                });
            });
        return result;
    }
 
    return difference;
 
});