Skip to content

Commit

Permalink
support undefined where for list
Browse files Browse the repository at this point in the history
  • Loading branch information
seveibar committed May 6, 2024
1 parent 67f2e71 commit 85ba03b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ type SoupOps<
getUsing: (using: {
[key: `${string}_id`]: string
}) => Extract<T, { type: K }> | null
list: (where: any) => Extract<T, { type: K }>[]
list: (where?: any) => Extract<T, { type: K }>[]
}

export type SoupUtilObject = {
Expand Down Expand Up @@ -62,8 +62,8 @@ export const su: GetSoupUtilObject = ((soup: AnySoupElement[]) => {
keys.every((key) => e[key] === where[key])
)
},
list: (where: any) => {
const keys = Object.keys(where)
list: (where?: any) => {
const keys = !where ? [] : Object.keys(where)
return soup.filter(
(e: any) =>
e.type === component_type &&
Expand Down

0 comments on commit 85ba03b

Please sign in to comment.