jty
    Preparing search index...

    Function isStrIdx

    • Checks if x is a valid string index for str.

      Parameters

      • x: unknown

        The value to check if it's a valid index.

      • str: string

        The string to check against.

      Returns x is number

      true if x is a valid index for str, false otherwise.

      if str is not a string.

      isStrIdx(0, 'ab') // => true
      isStrIdx(1, 'ab') // => true
      isStrIdx(2, 'ab') // => false
      isStrIdx(-1, 'ab') // => false
      isStrIdx(0.5, 'ab') // => false