From bb659cfbf65a2ecef038a0bcc6eb23082f9bca88 Mon Sep 17 00:00:00 2001 From: Balavishnu V J Date: Wed, 23 Sep 2020 00:02:27 +0530 Subject: [PATCH] fix: default case --- src/simple-queries.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/simple-queries.js b/src/simple-queries.js index 5c5dec2..d005572 100644 --- a/src/simple-queries.js +++ b/src/simple-queries.js @@ -18,18 +18,14 @@ export const variants = [ // } // }) -function getProxySyncMethod( - variant, - queries, - {allowMultiple, allowEmpty} = {}, -) { +function getProxySyncMethod(variant, queries, {allowMultiple, allowEmpty}) { const fnName = `${allowEmpty ? 'query' : 'get'}${ allowMultiple ? 'All' : '' }By${variant}` return queries[fnName] } -function getProxyAsyncMethod(variant, queries, {allowMultiple} = {}) { +function getProxyAsyncMethod(variant, queries, {allowMultiple}) { const fnName = `find${allowMultiple ? 'All' : ''}By${variant}` return queries[fnName] } @@ -40,7 +36,7 @@ function getSimpleQueries(utils) { variants.forEach(variant => { syncQueries[`fetchBy${variant}`] = ( matcher, - {allowMultiple, allowEmpty, ...options} = {}, + {allowMultiple = false, allowEmpty = false, ...options} = {}, ...args ) => { const fn = getProxySyncMethod(variant, utils, { @@ -51,7 +47,7 @@ function getSimpleQueries(utils) { } asyncQueries[`fetchBy${variant}Async`] = ( matcher, - {allowMultiple, ...options} = {}, + {allowMultiple = false, ...options} = {}, ...args ) => { const fn = getProxyAsyncMethod(variant, utils, {