From ce6d45823f5846423c9a4ffd64e0fc1b7877d39d Mon Sep 17 00:00:00 2001 From: Muthu Kumar Date: Sat, 12 May 2018 20:52:36 +0530 Subject: [PATCH] [fix] call custom predicate --- lib/slideHelper.js | 2 +- test.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/slideHelper.js b/lib/slideHelper.js index fc8a714..b61fab7 100644 --- a/lib/slideHelper.js +++ b/lib/slideHelper.js @@ -26,7 +26,7 @@ const startSliding = (k, predicate, host, guest, window, windowPos) => { const test = predicate ? predicate : isEq; - const firstMatch = host.findIndex(wrap(isEq, window[0])); + const firstMatch = host.findIndex(wrap(test, window[0])); // If first item returns a match, then continue to slideNext() const len = firstMatch ? slideNext(host, guest, firstMatch, windowPos) : undefined; diff --git a/test.js b/test.js index 2d21dda..0dad246 100644 --- a/test.js +++ b/test.js @@ -3,5 +3,5 @@ const Slider = require('.'); const a = [ 0, 1, 2, 3, 4, 5 ]; const b = [ 2, 3, 4 ]; -const w = new Slider({ size: 3 }); +const w = new Slider({ size: 3 , predicate: (a, b) => a === b }); console.log(w.slide(a, b)); \ No newline at end of file