Skip to main content

doesNotContain helper function

It would be handy if a function similar to the following is present alongside contains().

/**
 * Check if an array does not contain a value.
 * @param array - The array to check
 * @param value - The value to check for
 * @returns true if the array does not contain the value, true otherwise
 */
export const doesNotContain = (array: Array<any>, value: any) =>
  !array.includes(value);
Status: Canceled1 comment

Log in to comment and vote

Comments1

  • Sridhar Katakam

    •

    Apr 30, 2025

    This is low priority because we can use isFalsy with contains().