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 Parameter | Default type |
---|---|
T | Token |
Constructors
Constructor
new TokenCollection<T>(values?): TokenCollection<T>;
Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2015.collection.d.ts:116
Parameters
Parameter | Type |
---|---|
values? | null | readonly T [] |
Returns
TokenCollection
<T
>
Inherited from
Set<T>.constructor
Constructor
new TokenCollection<T>(iterable?): TokenCollection<T>;
Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2015.collection.d.ts:116
Parameters
Parameter | Type |
---|---|
iterable? | null | Iterable <T , any , any > |
Returns
TokenCollection
<T
>
Inherited from
Set<T>.constructor
Properties
[toStringTag]
readonly [toStringTag]: string;
Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts:145
Inherited from
Set.[toStringTag]
size
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
Set.size
[species]
readonly static [species]: SetConstructor;
Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts:322
Inherited from
Set.[species]
Methods
[iterator]()
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
Set.[iterator]
add()
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
Parameter | Type |
---|---|
value | T |
Returns
this
Inherited from
Set.add
clear()
clear(): void;
Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2015.collection.d.ts:95
Returns
void
Inherited from
Set.clear
delete()
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
Parameter | Type |
---|---|
value | T |
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
difference()
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
Parameter | Type |
---|---|
other | ReadonlySetLike <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
entries()
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
Set.entries
every()
every(callback): boolean;
Defined in: packages/tokens/src/token-collection.ts:39
Parameters
Parameter | Type |
---|---|
callback | (token ) => boolean |
Returns
boolean
filter()
filter(callback): TokenCollection<T>;
Defined in: packages/tokens/src/token-collection.ts:27
Filters the list of tokens
Parameters
Parameter | Type | Description |
---|---|---|
callback | (token ) => boolean | your filter function |
Returns
TokenCollection
<T
>
a collection of tokens matched by your filter function
find()
find(callback): undefined | T;
Defined in: packages/tokens/src/token-collection.ts:17
Find a token
Parameters
Parameter | Type | Description |
---|---|---|
callback | (token ) => boolean | your search function |
Returns
undefined
| T
the first token matched by the provided callback
forEach()
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
Parameter | Type |
---|---|
callbackfn | (value , value2 , set ) => void |
thisArg? | any |
Returns
void
Inherited from
Set.forEach
has()
has(value): boolean;
Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2015.collection.d.ts:108
Parameters
Parameter | Type |
---|---|
value | T |
Returns
boolean
a boolean indicating whether an element with the specified value exists in the Set or not.
Inherited from
Set.has
intersection()
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
Parameter | Type |
---|---|
other | ReadonlySetLike <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
isDisjointFrom()
isDisjointFrom(other): boolean;
Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.esnext.collection.d.ts:64
Parameters
Parameter | Type |
---|---|
other | ReadonlySetLike <unknown > |
Returns
boolean
a boolean indicating whether this Set has no elements in common with the argument.
Inherited from
Set.isDisjointFrom
isSubsetOf()
isSubsetOf(other): boolean;
Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.esnext.collection.d.ts:56
Parameters
Parameter | Type |
---|---|
other | ReadonlySetLike <unknown > |
Returns
boolean
a boolean indicating whether all the elements in this Set are also in the argument.
Inherited from
Set.isSubsetOf
isSupersetOf()
isSupersetOf(other): boolean;
Defined in: node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.esnext.collection.d.ts:60
Parameters
Parameter | Type |
---|---|
other | ReadonlySetLike <unknown > |
Returns
boolean
a boolean indicating whether all the elements in the argument are also in this Set.
Inherited from
Set.isSupersetOf
keys()
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
Set.keys
map()
map<U>(callback): TokenCollection<U>;
Defined in: packages/tokens/src/token-collection.ts:31
Type Parameters
Type Parameter |
---|
U |
Parameters
Parameter | Type |
---|---|
callback | (token ) => U |
Returns
TokenCollection
<U
>
merge()
merge(tokens): TokenCollection<T>;
Defined in: packages/tokens/src/token-collection.ts:49
Merges this collection with another token collection
Parameters
Parameter | Type | Description |
---|---|---|
tokens | TokenCollection <T > | the other token collection |
Returns
TokenCollection
<T
>
the merged token collection
some()
some(callback): boolean;
Defined in: packages/tokens/src/token-collection.ts:35
Parameters
Parameter | Type |
---|---|
callback | (token ) => boolean |
Returns
boolean
symmetricDifference()
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
Parameter | Type |
---|---|
other | ReadonlySetLike <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
union()
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
Parameter | Type |
---|---|
other | ReadonlySetLike <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
values()
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
Set.values