Removes item from a sorted array if it exists, returning the modified array.

let data = [ 1, 2, 3, 4 ];
data = remove(data, 3);
// [ 1, 2, 4 ]

By default uses Javascript comparision semantics. Passing in comparer is needed when working with an array of objects.

  • Type Parameters

    • T

    Parameters

    • data: T[]
    • toRemove: T
    • comparer: Comparer<T> = defaultComparer

    Returns T[]