npm.io
2.0.23 • Published 7 years ago

the-check

Licence
MIT
Version
2.0.23
Deps
6
Size
73 kB
Vulns
0
Weekly
0
DeprecatedThis package is deprecated

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.

Keywords