1.1.0 • Published 4 years ago

@orioro/validate-type v1.1.0

Weekly downloads
13
License
ISC
Repository
-
Last release
4 years ago

validateType

npm install @orioro/validate-type
yarn add @orioro/validate-type

Simple type validation utilities. Meant for checking types of argument input in microlibraries. For more complex use cases, such as object property or array item validation, see either:

API Docs

getType(value)
  • value {*}
  • Returns: type {string} Possible values:
    • string
    • regexp
    • number
    • bigint
    • nan
    • null
    • undefined
    • boolean
    • function
    • object
    • array
    • date
    • symbol
    • map
    • set
    • weakmap
    • weakset
typeValidator(getType)
isType(expectedType, value)
  • expectedType {string[] | string}
  • value {*}
  • Returns: {boolean}
validateType(expectedType, value)

If typing is invalid, throws TypeError. Returns nothing (undefined) otherwise.

  • expectedType {string[] | string}
  • value {*}
  • Returns: {undefined}
2.0.0

4 years ago

1.4.0

4 years ago

1.3.1

4 years ago

1.2.0

4 years ago

1.3.0

4 years ago

1.1.0

4 years ago

1.0.0

4 years ago