diff --git a/lib/helpers/array.js b/lib/helpers/array.js index aa11bf6..bb63bb5 100644 --- a/lib/helpers/array.js +++ b/lib/helpers/array.js @@ -92,18 +92,21 @@ export class MiniArray extends Array { const values = flattenArgs(args) const flattenArray = this.deepFlat() const toAddValues = values.filter((value) => !flattenArray.includes(value)) - + deepRemove(this, values) this.push(...toAddValues) return this } - add(value) { - let index = this.indexOf(value) - if (index !== -1) return this + add(...args) { + const flattenArray = this.deepFlat() + const toAddValues = flattenArgs(args).filter( + (value) => !flattenArray.includes(value) + ) + + this.push(...toAddValues) - this.push(value) return this }