1 | var difference = require('./difference');
|
2 | var slice = require('./slice');
|
3 |
|
4 | /**
|
5 | * Insert item into array if not already present.
|
6 | */
|
7 | function insert(arr, rest_items) {
|
8 | var diff = difference(slice(arguments, 1), arr);
|
9 | if (diff.length) {
|
10 | Array.prototype.push.apply(arr, diff);
|
11 | }
|
12 | return arr.length;
|
13 | }
|
14 | module.exports = insert;
|
15 |
|