From 09e4c0981d42254b78a6610f55cc832b16c16686 Mon Sep 17 00:00:00 2001 From: Muthu Kumar Date: Fri, 20 Apr 2018 02:23:58 +0530 Subject: [PATCH] [fuse] Added Fuse#else --- index.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/index.js b/index.js index 144eb74..0606489 100644 --- a/index.js +++ b/index.js @@ -155,6 +155,16 @@ class Fuse extends FuseItem { } /** + * Accepts a consequent function which automatically becomes resolve. + * Does not return a Fuse instance as .on after .else would be useless. + * @param {callback} consequent Consequent callback function + * @returns {Fuse} Returns new FuseItem instance + */ + else(consequent) { + return new FuseItem(this.value, consequent); + } + + /** * Accepts a value instead of a test function, and checks for strict * equality with this.value. * @param {any} value Any value to check against this.value