1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 1 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; }); |