21 lines
427 B
JavaScript
21 lines
427 B
JavaScript
|
"use strict";
|
||
|
|
||
|
Object.defineProperty(exports, "__esModule", {
|
||
|
value: true
|
||
|
});
|
||
|
exports.default = addNewValuesOnly;
|
||
|
function addIfNew(list, value) {
|
||
|
if (list.indexOf(value) === -1) {
|
||
|
list.push(value);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function addNewValuesOnly(list, values) {
|
||
|
if (Array.isArray(values)) {
|
||
|
for (var i = 0, len = values.length; i < len; ++i) {
|
||
|
addIfNew(list, values[i]);
|
||
|
}
|
||
|
} else {
|
||
|
addIfNew(list, values);
|
||
|
}
|
||
|
}
|