2.0.0 • Published 6 years ago

@caiogondim/arg-type v2.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

arg-type

Like prop-types, but for vanilla JavaScript

Installation

npm i -S @caiogondim/arg-type

Usage

Example:

import argType, { types } from '@caiogondim/arg-type'

function sum(a, b) {
  argType(a, types.number)
  argType(b, types.number)

  return a + b
}

sum(1, '2') // => throws TypeError because '2' is not a Number

Types

  • types.array
  • types.bool
  • types.func
  • types.number
  • types.object
  • types.string
  • types.null
  • types.symbol
  • types.instanceOf
  • types.oneOf
  • types.oneOfType
  • types.arrayOf
  • types.exact

caiogondim.com  ·  GitHub @caiogondim  ·  Twitter @caio_gondim

2.0.0

6 years ago

1.2.1

7 years ago

1.2.0

7 years ago

1.1.0

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago