Function equalsOneOf

  • Remarks

    This function functions equivalently to (and is implemented with) the built-in Array.includes. It is included in Flurp partly for its expressive semantics, because mostly because equalsOneOf can use a more concise type annotation when the type of possible inputs is wider than the elements of the array.

    Type Parameters

    • T

    Parameters

    • arr: T[]
      import * as L from "flurp/logic";

      const isVowel = L.equals<string | number>(["a", "e", "i", 'o", "u"]);
      isVowel("a"); // true;
      isVowel("b"); // false;
      isVowel(5); // false;

    Returns ((x: T) => boolean)

      • (x: T): boolean
      • Parameters

        • x: T

        Returns boolean