lazyIncludes

Returns a boolean of whether not the first parameter (array or string) includes the second parameter, ignoring case. You can also optionally pass in other character types to ignore.

function lazyIncludes<T extends string | any[]>(
  a: T,
  b: T extends (infer U)[] ? U : string,
  config: { ignore: CharacterType[] } = { ignore: [] }

type CharacterType =
  | "letters"
  | "numbers"
  | "spaces"
  | "special"
  | "lowercase"
  | "uppercase"
  | "punctuation"

// Example:

lazyIncludes("Hello world", "LL") //=> true

lazyIncludes("McDonald's", "mcdonalds", { ignore: ["punctuation"] }) //=> true

lazyIncludes("h e l l o", "hello", { ignore: ["spaces"] }) //=> true