Skip to content

Commit

Permalink
refactor: remove unnecessary abstraction
Browse files Browse the repository at this point in the history
  • Loading branch information
angeloashmore committed May 27, 2021
1 parent 7fd6541 commit d976a11
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,17 +129,6 @@ const findRef = (refs: Ref[], predicate: (ref: Ref) => boolean): Ref => {
return ref;
};

/**
* Returns a copy of an array of refs without the master ref, is present.
*
* @param refs A list of refs.
*
* @returns `refs` without the master ref, is present.
*/
const onlyReleaseRefs = (refs: Ref[]): Ref[] => {
return refs.filter(ref => !ref.isMasterRef);
};

/**
* Creates a Prismic client that can be used to query a repository.
*
Expand Down Expand Up @@ -718,7 +707,9 @@ export class Client {
* @returns A list of all Releases for the Prismic repository.
*/
async getReleases(): Promise<Ref[]> {
return onlyReleaseRefs(await this.getRefs());
const refs = await this.getRefs();

return refs.filter(ref => !ref.isMasterRef);
}

/**
Expand Down

0 comments on commit d976a11

Please sign in to comment.