Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
ui-component-library / src / forms / deps / isValidLength.ts
Size: Mime:
// import { size } from 'chain-able-boost'

const DEFAULT_MIN = 0
const DEFAULT_MAX = 100

function isValidLength(
  value: number | string,
  minLength: number = DEFAULT_MIN,
  maxLength: number = DEFAULT_MAX
): boolean {
  const length = String(value).length
  return length > minLength && length < maxLength
}

// | ValidMap | ValidSet < handled by size bu tned to import
type ValidValue = number | string | Array<any> | Object

function isValidLengthCurried(
  minLength: number = DEFAULT_MIN,
  maxLength: number = DEFAULT_MAX
) {
  return function isValidLengthCurriedValue(value: ValidValue) {
    return isValidLength(value, minLength, maxLength)
  }
}

export { isValidLength, isValidLengthCurried }
export default isValidLength