Code coverage report for array/insert.js

Statements: 100% (8 / 8)      Branches: 100% (2 / 2)      Functions: 100% (3 / 3)      Lines: 100% (7 / 7)     

All files » array/ » insert.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 151         1 4 4 2   4   1    
define(['./difference', '../lang/toArray'], function (difference, toArray) {
 
    /**
     * Insert item into array if not already present.
     */
    function insert(arr, rest_items) {
        var diff = difference(toArray(arguments).slice(1), arr);
        if (diff.length) {
            Array.prototype.push.apply(arr, diff);
        }
        return arr.length;
    }
    return insert;
});