2.0.23 • Published 5 years ago

the-check v2.0.23

Weekly downloads
9
License
MIT
Repository
github
Last release
5 years ago

the-check

Build Status npm Version JS Standard

Check utility for the-framework

Installation

$ npm install the-check --save

Usage

'use strict'

const { unlessProduction } = require('the-check')

async function tryExample () {

  function myFunc (someArg) {
    // Run check only if `process.env.NODE_ENV !=== 'production'`
    unlessProduction(({ ok, equal }) => {
      ok(someArg, 'someArg is required!')
      equal(typeof someArg === 'string', 'someArg must be a string!')
    })
  }

  myFunc('hoge')
}

tryExample().catch((err) => console.error(err))

API Guide

License

This software is released under the MIT License.

Links