1
0
mirror of https://github.com/flarum/core.git synced 2025-07-18 07:11:17 +02:00

docs: ItemList set methods throw errors when keys are not present

This commit is contained in:
David Wheatley
2022-05-20 17:38:25 +01:00
parent 29362ed924
commit e45547c649

View File

@@ -127,7 +127,7 @@ export default class ItemList<T> {
/**
* Replaces an item's content, if the provided item key exists.
*
* If the provided `key` is not present, nothing will happen.
* If the provided `key` is not present, an error will be thrown.
*
* @param key The key of the item in the list
* @param content The item's new content
@@ -154,7 +154,7 @@ export default class ItemList<T> {
/**
* Replaces an item's priority, if the provided item key exists.
*
* If the provided `key` is not present, nothing will happen.
* If the provided `key` is not present, an error will be thrown.
*
* @param key The key of the item in the list
* @param priority The item's new priority
@@ -181,6 +181,8 @@ export default class ItemList<T> {
/**
* Remove an item from the list.
*
* If the provided `key` is not present, nothing will happen.
*/
remove(key: string): this {
delete this._items[key];