Theemo / @theemo/tokens / TokenCollection
Class: TokenCollection<T>
Collection of tokens.
Well suited to manage tokens
Extends
Set
<T
>
Type Parameters
Type Parameter | Default type |
---|---|
T | Token |
Constructors
new TokenCollection()
new TokenCollection<T>(values?): TokenCollection<T>
Parameters
Parameter | Type |
---|---|
values ? | null | readonly T [] |
Returns
Inherited from
Set<T>.constructor
Defined in
node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2015.collection.d.ts:116
new TokenCollection()
new TokenCollection<T>(iterable?): TokenCollection<T>
Parameters
Parameter | Type |
---|---|
iterable ? | null | Iterable <T , any , any > |
Returns
Inherited from
Set<T>.constructor
Defined in
node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2015.collection.d.ts:116
Properties
[toStringTag]
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
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]
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]()
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()
add(value): this
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
Defined in
node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2015.collection.d.ts:93
clear()
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()
delete(value): boolean
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
Defined in
node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2015.collection.d.ts:100
difference()
difference<U>(other): Set<T>
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
Defined in
node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.esnext.collection.d.ts:48
entries()
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()
every(callback): boolean
Parameters
Parameter | Type |
---|---|
callback | (token ) => boolean |
Returns
boolean
Defined in
packages/@theemo/tokens/src/token-collection.ts:39
filter()
filter(callback): TokenCollection<T>
Filters the list of tokens
Parameters
Parameter | Type | Description |
---|---|---|
callback | (token ) => boolean | your filter function |
Returns
a collection of tokens matched by your filter function
Defined in
packages/@theemo/tokens/src/token-collection.ts:27
find()
find(callback): undefined | T
Find a token
Parameters
Parameter | Type | Description |
---|---|---|
callback | (token ) => boolean | your search function |
Returns
undefined
| T
the first token matched by the provided callback
Defined in
packages/@theemo/tokens/src/token-collection.ts:17
forEach()
forEach(callbackfn, thisArg?): void
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
Defined in
node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2015.collection.d.ts:104
has()
has(value): boolean
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
Defined in
node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2015.collection.d.ts:108
intersection()
intersection<U>(other): Set<T & U>
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
Defined in
node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.esnext.collection.d.ts:44
isDisjointFrom()
isDisjointFrom(other): boolean
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
Defined in
node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.esnext.collection.d.ts:64
isSubsetOf()
isSubsetOf(other): boolean
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
Defined in
node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.esnext.collection.d.ts:56
isSupersetOf()
isSupersetOf(other): boolean
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
Defined in
node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.esnext.collection.d.ts:60
keys()
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()
map<U>(callback): TokenCollection<U>
Type Parameters
Type Parameter |
---|
U |
Parameters
Parameter | Type |
---|---|
callback | (token ) => U |
Returns
Defined in
packages/@theemo/tokens/src/token-collection.ts:31
merge()
merge(tokens): TokenCollection<T>
Merges this collection with another token collection
Parameters
Parameter | Type | Description |
---|---|---|
tokens | TokenCollection <T > | the other token collection |
Returns
the merged token collection
Defined in
packages/@theemo/tokens/src/token-collection.ts:49
some()
some(callback): boolean
Parameters
Parameter | Type |
---|---|
callback | (token ) => boolean |
Returns
boolean
Defined in
packages/@theemo/tokens/src/token-collection.ts:35
symmetricDifference()
symmetricDifference<U>(other): Set<T | U>
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
Defined in
node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.esnext.collection.d.ts:52
union()
union<U>(other): Set<T | U>
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
Defined in
node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.esnext.collection.d.ts:40
values()
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