Skip to content

Commit

Permalink
Remove extra JSDoc comment
Browse files Browse the repository at this point in the history
  • Loading branch information
davwheat committed Aug 22, 2021
1 parent 2af54b1 commit f8182b8
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions js/src/common/utils/ItemList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,16 @@ export default class ItemList<T> {
* This **does not** preserve the original types of primitives and proxies
* all content values to make `itemName` accessible on them.
*
* **NOTE:** If your ItemList holds primitive types (such as numbers, booleans
* or strings), these will be converted to their object counterparts if you do
* not provide `true` to this function.
*
* **NOTE:** Modifying any objects in the final array may also update the
* content of the original ItemList.
*
* @param keepPrimitives Converts item content to objects and sets the
* `itemName` property on them.
*
* @see https://github.com/flarum/core/issues/3030
*/
toArray(keepPrimitives?: false): (T & { itemName: string })[];
Expand All @@ -215,25 +222,12 @@ export default class ItemList<T> {
*
* **NOTE:** Modifying any objects in the final array may also update the
* content of the original ItemList.
*/
toArray(keepPrimitives: true): (T extends object ? T & Readonly<{ itemName: string }> : T)[];

/**
* Convert the list into an array of item content arranged by priority.
*
* Each item's content will be assigned an `itemName` property equal to the
* item's unique key.
*
* **NOTE:** If your ItemList holds primitive types (such as numbers, booleans
* or strings), these will be converted to their object counterparts if you do
* not provide `true` to this function.
*
* **NOTE:** Modifying any objects in the final array may also update the
* content of the original ItemList.
*
* @param keepPrimitives Converts item content to objects and sets the
* `itemName` property on them.
*/
toArray(keepPrimitives: true): (T extends object ? T & Readonly<{ itemName: string }> : T)[];

toArray(keepPrimitives: boolean = false): T[] | (T & Readonly<{ itemName: string }>)[] {
const items: Item<T>[] = Object.keys(this._items).map((key, i) => {
const item = this._items[key];
Expand Down

0 comments on commit f8182b8

Please sign in to comment.