diff --git a/structures/deck.js b/structures/deck.js index f36d431..402040d 100644 --- a/structures/deck.js +++ b/structures/deck.js @@ -1,10 +1,5 @@ class Deck extends Array { - constructor (...args) { - if(args.length === 1) return args; - return super(...args); - } - recurse (fn) { let index = 0; const call = (arr, acc = []) => { @@ -26,11 +21,6 @@ class Deck extends Array { } return -1; } - - empty () { - this.recurse(i => this.splice(i)); - return this; - } }; module.exports = Deck; \ No newline at end of file diff --git a/structures/slider.js b/structures/slider.js index e44504e..654f659 100644 --- a/structures/slider.js +++ b/structures/slider.js @@ -17,8 +17,8 @@ class Slider { const k = this.windowSize; - const host = new Deck(...master); - const guest = new Deck(...compare); + const host = Deck.from(master); + const guest = Deck.from(compare); const startSliding = (window, i) => { @@ -30,13 +30,13 @@ class Slider { )) !== -1 ) return [ firstMatch, i ]; - const newWindow = new Deck(...guest.slice(++i, k)); + const newWindow = Deck.from(guest.slice(++i, k)); if(newWindow.length !== 0 && newWindow.length === k) return recurse(newWindow, i); return [ -1, -1 ]; }; - const window = new Deck(...guest.slice(0, k)); + const window = Deck.from(guest.slice(0, k)); const index = startSliding(window, 0); return index; }