Skip to content

Theemo / @theemo/tokens / TokenCollection

Class: TokenCollection<T>

Collection of tokens.

Well suited to manage tokens

Extends

  • Set<T>

Type Parameters

Type ParameterDefault type
TToken

Constructors

new TokenCollection()

ts
new TokenCollection<T>(values?): TokenCollection<T>

Parameters

ParameterType
values?null | readonly T[]

Returns

TokenCollection<T>

Inherited from

Set<T>.constructor

Defined in

node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2015.collection.d.ts:116

new TokenCollection()

ts
new TokenCollection<T>(iterable?): TokenCollection<T>

Parameters

ParameterType
iterable?null | Iterable<T, any, any>

Returns

TokenCollection<T>

Inherited from

Set<T>.constructor

Defined in

node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2015.collection.d.ts:116

Properties

[toStringTag]

ts
readonly [toStringTag]: string;

Inherited from

Set.[toStringTag]

Defined in

node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts:145


size

ts
readonly size: number;

Returns

the number of (unique) elements in Set.

Inherited from

Set.size

Defined in

node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2015.collection.d.ts:112


[species]

ts
readonly static [species]: SetConstructor;

Inherited from

Set.[species]

Defined in

node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts:322

Methods

[iterator]()

ts
iterator: SetIterator<T>

Iterates over values in the set.

Returns

SetIterator<T>

Inherited from

Set.[iterator]

Defined in

node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2015.iterable.d.ts:198


add()

ts
add(value): this

Appends a new element with a specified value to the end of the Set.

Parameters

ParameterType
valueT

Returns

this

Inherited from

Set.add

Defined in

node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2015.collection.d.ts:93


clear()

ts
clear(): void

Returns

void

Inherited from

Set.clear

Defined in

node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2015.collection.d.ts:95


delete()

ts
delete(value): boolean

Removes a specified value from the Set.

Parameters

ParameterType
valueT

Returns

boolean

Returns true if an element in the Set existed and has been removed, or false if the element does not exist.

Inherited from

Set.delete

Defined in

node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2015.collection.d.ts:100


difference()

ts
difference<U>(other): Set<T>

Type Parameters

Type Parameter
U

Parameters

ParameterType
otherReadonlySetLike<U>

Returns

Set<T>

a new Set containing all the elements in this Set which are not also in the argument.

Inherited from

Set.difference

Defined in

node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.esnext.collection.d.ts:48


entries()

ts
entries(): SetIterator<[T, T]>

Returns an iterable of [v,v] pairs for every value v in the set.

Returns

SetIterator<[T, T]>

Inherited from

Set.entries

Defined in

node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2015.iterable.d.ts:202


every()

ts
every(callback): boolean

Parameters

ParameterType
callback(token) => boolean

Returns

boolean

Defined in

packages/@theemo/tokens/src/token-collection.ts:39


filter()

ts
filter(callback): TokenCollection<T>

Filters the list of tokens

Parameters

ParameterTypeDescription
callback(token) => booleanyour filter function

Returns

TokenCollection<T>

a collection of tokens matched by your filter function

Defined in

packages/@theemo/tokens/src/token-collection.ts:27


find()

ts
find(callback): undefined | T

Find a token

Parameters

ParameterTypeDescription
callback(token) => booleanyour search function

Returns

undefined | T

the first token matched by the provided callback

Defined in

packages/@theemo/tokens/src/token-collection.ts:17


forEach()

ts
forEach(callbackfn, thisArg?): void

Executes a provided function once per each value in the Set object, in insertion order.

Parameters

ParameterType
callbackfn(value, value2, set) => void
thisArg?any

Returns

void

Inherited from

Set.forEach

Defined in

node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2015.collection.d.ts:104


has()

ts
has(value): boolean

Parameters

ParameterType
valueT

Returns

boolean

a boolean indicating whether an element with the specified value exists in the Set or not.

Inherited from

Set.has

Defined in

node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2015.collection.d.ts:108


intersection()

ts
intersection<U>(other): Set<T & U>

Type Parameters

Type Parameter
U

Parameters

ParameterType
otherReadonlySetLike<U>

Returns

Set<T & U>

a new Set containing all the elements which are both in this Set and in the argument.

Inherited from

Set.intersection

Defined in

node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.esnext.collection.d.ts:44


isDisjointFrom()

ts
isDisjointFrom(other): boolean

Parameters

ParameterType
otherReadonlySetLike<unknown>

Returns

boolean

a boolean indicating whether this Set has no elements in common with the argument.

Inherited from

Set.isDisjointFrom

Defined in

node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.esnext.collection.d.ts:64


isSubsetOf()

ts
isSubsetOf(other): boolean

Parameters

ParameterType
otherReadonlySetLike<unknown>

Returns

boolean

a boolean indicating whether all the elements in this Set are also in the argument.

Inherited from

Set.isSubsetOf

Defined in

node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.esnext.collection.d.ts:56


isSupersetOf()

ts
isSupersetOf(other): boolean

Parameters

ParameterType
otherReadonlySetLike<unknown>

Returns

boolean

a boolean indicating whether all the elements in the argument are also in this Set.

Inherited from

Set.isSupersetOf

Defined in

node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.esnext.collection.d.ts:60


keys()

ts
keys(): SetIterator<T>

Despite its name, returns an iterable of the values in the set.

Returns

SetIterator<T>

Inherited from

Set.keys

Defined in

node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2015.iterable.d.ts:206


map()

ts
map<U>(callback): TokenCollection<U>

Type Parameters

Type Parameter
U

Parameters

ParameterType
callback(token) => U

Returns

TokenCollection<U>

Defined in

packages/@theemo/tokens/src/token-collection.ts:31


merge()

ts
merge(tokens): TokenCollection<T>

Merges this collection with another token collection

Parameters

ParameterTypeDescription
tokensTokenCollection<T>the other token collection

Returns

TokenCollection<T>

the merged token collection

Defined in

packages/@theemo/tokens/src/token-collection.ts:49


some()

ts
some(callback): boolean

Parameters

ParameterType
callback(token) => boolean

Returns

boolean

Defined in

packages/@theemo/tokens/src/token-collection.ts:35


symmetricDifference()

ts
symmetricDifference<U>(other): Set<T | U>

Type Parameters

Type Parameter
U

Parameters

ParameterType
otherReadonlySetLike<U>

Returns

Set<T | U>

a new Set containing all the elements which are in either this Set or in the argument, but not in both.

Inherited from

Set.symmetricDifference

Defined in

node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.esnext.collection.d.ts:52


union()

ts
union<U>(other): Set<T | U>

Type Parameters

Type Parameter
U

Parameters

ParameterType
otherReadonlySetLike<U>

Returns

Set<T | U>

a new Set containing all the elements in this Set and also all the elements in the argument.

Inherited from

Set.union

Defined in

node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.esnext.collection.d.ts:40


values()

ts
values(): SetIterator<T>

Returns an iterable of values in the set.

Returns

SetIterator<T>

Inherited from

Set.values

Defined in

node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2015.iterable.d.ts:211