TokenList

No summary available

Import
the javascript logo
import { TokenList } from "@schukai/monster/source/types/tokenlist.mjs";
Source
the git logo
Package
the npm logo
Since
1.2.0

Exported

TokenList

Derived from

Base

Options

The Options listed in this section are defined directly within the class. This class is derived from several parent classes. Therefore, it inherits Options from these parent classes. If you cannot find a specific Options in this list, we recommend consulting the documentation of the Base.

Option
Type
Default
Description
-/-

Properties

The Properties listed in this section are defined directly within the class. This class is derived from several parent classes. Therefore, it inherits Properties from these parent classes. If you cannot find a specific Properties in this list, we recommend consulting the documentation of the Base.

Methods

The methods listed in this section are defined directly within the class. This class is derived from several parent classes. Therefore, it inherits methods from these parent classes. If you cannot find a specific method in this list, we recommend consulting the documentation of the Base.

Constructor

constructor(init)
Parameters
  • init {array|string|iteratable}: init

Behavioral methods

add(value)
Parameters
  • value {array|string|iteratable}: value
Returns
  • {TokenList}
Throws
  • {TypeError} unsupported value
Add tokens
clear()
Returns
  • {TokenList}
remove all tokens
remove(value)
Parameters
  • value {array|string|iteratable}: value
Returns
  • {TokenList}
Throws
  • {TypeError} unsupported value
Removes token
toggle(value)
Parameters
  • value {array|string|iteratable}: value
Returns
  • {boolean}
Throws
  • {TypeError} unsupported value
Removes token from string. If token doesn't exist it's added.

Structural methods

getIterator()
Returns
  • {Symbol.iterator}
Iterator protocol

Other methods

[Symbol.iterator]()
Returns
  • {{next:}: ({value: *, done: boolean}))|*)}}
Iterator
contains(value)
Parameters
  • value {array|string|iteratable}: value
Returns
  • {boolean}
Returns true if it contains token, otherwise false
entries()
Returns
  • {array}
returns an array with all tokens
forEach(callback)
Parameters
  • callback {function}: callback
Returns
  • {TokenList}
executes the provided function with each value of the set
replace(token,newToken)
Parameters
  • token {string}: token
  • newToken {string}: newToken
Returns
  • {TokenList}
this method replaces a token with a new token. if the passed token exists, it is replaced with newToken and TokenList is returned. if the token does not exist, newToken is not set and TokenList is returned.
toString()
Returns
  • {string}
returns the individual tokens separated by a blank character

Events

This component does not fire any public events. It may fire events that are inherited from its parent classes.

The current width of the area is too small to display the content correctly.