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

Constructors

Constructor

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

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

Parameters

ParameterType
values?null | readonly T[]

Returns

TokenCollection<T>

Inherited from

ts
Set<T>.constructor

Constructor

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

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

Parameters

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

Returns

TokenCollection<T>

Inherited from

ts
Set<T>.constructor

Properties

[toStringTag]

ts
readonly [toStringTag]: string;

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

Inherited from

ts
Set.[toStringTag]

size

ts
readonly size: number;

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

Returns

the number of (unique) elements in Set.

Inherited from

ts
Set.size

[species]

ts
readonly static [species]: SetConstructor;

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

Inherited from

ts
Set.[species]

Methods

[iterator]()

ts
iterator: SetIterator<T>;

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

Iterates over values in the set.

Returns

SetIterator<T>

Inherited from

ts
Set.[iterator]

add()

ts
add(value): this;

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

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

Parameters

ParameterType
valueT

Returns

this

Inherited from

ts
Set.add

clear()

ts
clear(): void;

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

Returns

void

Inherited from

ts
Set.clear

delete()

ts
delete(value): boolean;

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

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

ts
Set.delete

difference()

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

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

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

ts
Set.difference

entries()

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

Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2015.iterable.d.ts:203

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

Returns

SetIterator<[T, T]>

Inherited from

ts
Set.entries

every()

ts
every(callback): boolean;

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

Parameters

ParameterType
callback(token) => boolean

Returns

boolean


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): undefined | T;

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

Find a token

Parameters

ParameterTypeDescription
callback(token) => booleanyour search function

Returns

undefined | T

the first token matched by the provided callback


forEach()

ts
forEach(callbackfn, thisArg?): void;

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

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

ts
Set.forEach

has()

ts
has(value): boolean;

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

Parameters

ParameterType
valueT

Returns

boolean

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

Inherited from

ts
Set.has

intersection()

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

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

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

ts
Set.intersection

isDisjointFrom()

ts
isDisjointFrom(other): boolean;

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

Parameters

ParameterType
otherReadonlySetLike<unknown>

Returns

boolean

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

Inherited from

ts
Set.isDisjointFrom

isSubsetOf()

ts
isSubsetOf(other): boolean;

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

Parameters

ParameterType
otherReadonlySetLike<unknown>

Returns

boolean

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

Inherited from

ts
Set.isSubsetOf

isSupersetOf()

ts
isSupersetOf(other): boolean;

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

Parameters

ParameterType
otherReadonlySetLike<unknown>

Returns

boolean

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

Inherited from

ts
Set.isSupersetOf

keys()

ts
keys(): SetIterator<T>;

Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2015.iterable.d.ts:208

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

Returns

SetIterator<T>

Inherited from

ts
Set.keys

map()

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

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

Type Parameters

Type Parameter
U

Parameters

ParameterType
callback(token) => U

Returns

TokenCollection<U>


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


some()

ts
some(callback): boolean;

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

Parameters

ParameterType
callback(token) => boolean

Returns

boolean


symmetricDifference()

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

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

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

ts
Set.symmetricDifference

union()

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

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

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

ts
Set.union

values()

ts
values(): SetIterator<T>;

Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2015.iterable.d.ts:213

Returns an iterable of values in the set.

Returns

SetIterator<T>

Inherited from

ts
Set.values