export function toggleListItem()

in website/src/utils/jsUtils.ts [21:29]


  export function toggleListItem<T>(list: T[], item: T): T[] {
    const itemIndex = list.indexOf(item);
    if (itemIndex === -1) {
      return list.concat(item);
    }
    const newList = [...list];
    newList.splice(itemIndex, 1);
    return newList;
  }