1.0.2 • Published 7 years ago

inputtypes v1.0.2

Weekly downloads
1
License
ISC
Repository
github
Last release
7 years ago

InputTypes

Argument Validation Inspired by React's PropTypes API

Usage

var InputTypes = require('./input-types')

function App() { InputTypes.apply(App, arguments) }

App.inputTypes = [
  InputTypes.object,
  (val) => typeof val === InputTypes.string || typeof val === InputTypes.number,
  [
    InputTypes.number,
    InputTypes.string,
    [
      InputTypes.string,
      InputTypes.number,
      InputTypes.object
    ]
  ],
  InputTypes.func
]

App({a: '123'}, 'hello world', [1, '2', ['1', 3, {}]], () => {})

Quick Start

Setup

nvm install; npm test

quick start