jty
    Preparing search index...

    Function isStrLen

    • Checks if the provided value is a string AND its length is in a boundary (inclusive). If min and max are the same, it tests for exact length.

      Parameters

      • x: unknown

        possibly a string

      • minLen: number = 0

        minimum possible length (inclusive)

      • OptionalmaxLen: number

        maximum possible length (inclusive)

      Returns x is string

      This function delegates the length check to inRange, which may throw if minLen or maxLen are invalid.

      isStrLen('Hello', 2, 10) => true
      isStrLen('Hello', 5, 10) => true // 'Hello'.length is 5
      isStrLen('Exact', 5, 5) => true
      isStrLen('Hello', 5) => true // The length is at least 5
      isStrLen('Hello', undefined, 5) => true // The length is at most 5
      isStrLen('Too long', 1, 4) => false
      isStrLen(null, 1, 4) => false