Skip to content

Commit

Permalink
feat: Add general 'findCollection' method to Client
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-coster committed Aug 19, 2021
1 parent c84ba50 commit 01b1537
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/lib/BravoClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,13 @@ export class BravoClient extends FavroClient {
return this.cache.collections;
}

/** Find a collection using a match function. */
async findCollection(match: (collection: BravoCollection) => any) {
return (await this.listCollections()).find((collection) =>
match(collection),
);
}

/**
* Find a collection by name. Names are not required to be unique
* by Favro -- only the first match is returned.
Expand Down

0 comments on commit 01b1537

Please sign in to comment.