Skip to content

Commit

Permalink
Merge pull request solana-labs#14 from oJshua/tokenlist-interface
Browse files Browse the repository at this point in the history
feat: modify fluent interface to return new token list container
  • Loading branch information
oJshua authored Mar 4, 2021
2 parents 188f09c + dd188fa commit 69d4f1b
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/lib/tokenlist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,27 +125,27 @@ export class TokenListContainer {
constructor(private tokenList: TokenInfo[]) {}

filterByTag = (tag: string) => {
this.tokenList = this.tokenList.filter((item) =>
(item.tags || []).includes(tag)
return new TokenListContainer(
this.tokenList.filter((item) => (item.tags || []).includes(tag))
);
return this;
};

filterByChainId = (chainId: number | ENV) => {
this.tokenList = this.tokenList.filter((item) => item.chainId === chainId);
return this;
return new TokenListContainer(
this.tokenList.filter((item) => item.chainId === chainId)
);
};

excludeByChainId = (chainId: number | ENV) => {
this.tokenList = this.tokenList.filter((item) => item.chainId !== chainId);
return this;
return new TokenListContainer(
this.tokenList.filter((item) => item.chainId !== chainId)
);
};

excludeByTag = (tag: string) => {
this.tokenList = this.tokenList.filter(
(item) => !(item.tags || []).includes(tag)
return new TokenListContainer(
this.tokenList.filter((item) => !(item.tags || []).includes(tag))
);
return this;
};

filterByClusterSlug = (slug: string) => {
Expand Down

0 comments on commit 69d4f1b

Please sign in to comment.