Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "removeItem"

Index

Functions

Functions

removeItem

  • removeItem<T>(source: T[], data: T, finder?: undefined | function): T[]
  • Remove specific item that equal data or finded by finder from source.

    Type parameters

    • T

    Parameters

    • source: T[]
    • data: T
    • Optional finder: undefined | function

      A factory, data is second param, return a function just like Array.find.

      removeItem([1, '2', true, { a: 1 }], 0) => [1, '2', true, { a: 1 }]
      removeItem([1, '2', true, { a: 1 }], 1) => ['2', true, { a: 1 }]
      removeItem([{ a: 1 }, { a: 2 }, { a: 3 }, { a: 4 }], { a: 3 }, data => item => data.a === item.a)
      =>
      [{ a: 1 }, { a: 2 }, { a: 4 }]

    Returns T[]

Generated using TypeDoc