Constructor
new TrueSet(repr, classifieropt)
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
repr |
function | A function producing the class key for each item. |
||
classifier |
Classifier |
<optional> |
new Classifier() | The internal classifier. |
- Source:
Classes
Methods
add(item, xTimesopt) → {this}
Adds the item xTimes times.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
item |
* | |||
xTimes |
number |
<optional> |
1 |
- Source:
Returns:
- Type
- this
clear()
Remove all items
- Source:
get()
Iterates all the equivalent items
- Source:
has(item) → {boolean}
Parameters:
| Name | Type | Description |
|---|---|---|
item |
* |
- Source:
Returns:
whether an equivalent item exists
- Type
- boolean
n()
Total number of stored items
- Source:
peek(firstopt) → {*}
Returns (without removing) the first or last stored item.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
first |
boolean |
<optional> |
true |
- Source:
Returns:
the peeked item or undefined
- Type
- *
remove(item, xTimesopt) → {boolean}
Removes up to xTimes occurrences of the item.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
item |
* | |||
xTimes |
number |
<optional> |
Infinity |
- Source:
Returns:
true if removal occurred
- Type
- boolean
reverse() → {Iterator.<*>}
Returns an iterator of all items in reverse order.
- Source:
Returns:
- Type
- Iterator.<*>