ixfx
    Preparing search index...

    Function without

    • Returns an array with value(s) omitted.

      If value is not found, result will be a copy of input. Value checking is completed via the provided comparer function. By default checking whether a === b. To compare based on value, use the isEqualValueDefault comparer.

      Type Parameters

      • V

        Type of array items

      Parameters

      • sourceArray: readonly V[] | V[]

        Source array

      • toRemove: V | V[]

        Value(s) to remove

      • comparer: IsEqual<V> = isEqualDefault

        Comparison function. If not provided isEqualDefault is used, which compares using ===

      Returns V[]

      Copy of array without value.

      const data = [100, 20, 40];
      const filtered = without(data, 20); // [100, 40]
      const data = [{ name: `Alice` }, { name:`Sam` }];

      // This wouldn't work as expected, because the default comparer uses instance,
      // not value:
      without(data, { name: `Alice` });

      // So instead we can use a value comparer:
      without(data, { name:`Alice` }, isEqualValueDefault);
      const data = [ { name: `Alice` }, { name:`Sam` }];
      without(data, { name:`ALICE` }, (a, b) => {
      return (a.name.toLowerCase() === b.name.toLowerCase());
      });

      Consider remove to remove an item by index.