JS Utils Kit
    Preparing search index...

    Function isKebabCase

    • Checks if a string is in kebab-case format.

      A valid kebab-case string:

      • Contains only lowercase letters and numbers
      • Words are separated by single hyphens (-)
      • Does not start or end with a hyphen
      • Does not contain consecutive hyphens

      Parameters

      • value: string

        The input string

      Returns boolean

      True if the string is kebab-case.

      isKebabCase("hello-world") // true
      isKebabCase("hello-world-123") // true
      isKebabCase("Hello-world") // false
      isKebabCase("hello_world") // false
      isKebabCase("-hello-world") // false
      isKebabCase("hello-world-") // false
      isKebabCase("hello--world") // false