Skip to content

Theemo / @theemo/tokens / TokenCollection

Class: TokenCollection<T> ​

Defined in: packages/tokens/src/token-collection.ts:10

Collection of tokens.

Well suited to manage tokens

Extends ​

  • Set<T>

Type Parameters ​

Type ParameterDefault type
TToken

Methods ​

filter() ​

ts
filter(callback): TokenCollection<T>;

Defined in: packages/tokens/src/token-collection.ts:27

Filters the list of tokens

Parameters ​

ParameterTypeDescription
callback(token) => booleanyour filter function

Returns ​

TokenCollection<T>

a collection of tokens matched by your filter function


find() ​

ts
find(callback): T | undefined;

Defined in: packages/tokens/src/token-collection.ts:17

Find a token

Parameters ​

ParameterTypeDescription
callback(token) => booleanyour search function

Returns ​

T | undefined

the first token matched by the provided callback


merge() ​

ts
merge(tokens): TokenCollection<T>;

Defined in: packages/tokens/src/token-collection.ts:49

Merges this collection with another token collection

Parameters ​

ParameterTypeDescription
tokensTokenCollection<T>the other token collection

Returns ​

TokenCollection<T>

the merged token collection