Function stringIncludesOnlyOnce

  • Checks if given search value appears just onces in given value.

    Example

    const includesCommaOnce = stringIncludesOnlyOnce(",");
    includesCommaOnce("value,value"); // true
    includesCommaOnce("value,value,value"); // false
    includesCommaOnce("value"); // false

    Returns

    Curried function with search in context.

    Parameters

    • search: string

      Value to search.

    Returns ((value: unknown) => value is string)

      • (value: unknown): value is string
      • Parameters

        • value: unknown

        Returns value is string