Skip to content

Commit

Permalink
fix: default case
Browse files Browse the repository at this point in the history
  • Loading branch information
balavishnuvj committed Sep 22, 2020
1 parent 1c2d831 commit bb659cf
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/simple-queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]
}
Expand All @@ -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, {
Expand All @@ -51,7 +47,7 @@ function getSimpleQueries(utils) {
}
asyncQueries[`fetchBy${variant}Async`] = (
matcher,
{allowMultiple, ...options} = {},
{allowMultiple = false, ...options} = {},
...args
) => {
const fn = getProxyAsyncMethod(variant, utils, {
Expand Down

0 comments on commit bb659cf

Please sign in to comment.