@the-/check
Check utility for the-framework
Installation
$ npm install @the-/check --save
Usage
'use strict'
const {
strict: { equal, ok },
} = require('assert')
const { unlessProduction } = require('@the-/check')
async function tryExample() {
function myFunc(someArg) {
// Run check only if `process.env.NODE_ENV !=== 'production'`
unlessProduction(() => {
ok(someArg, 'someArg is required!')
equal(typeof someArg === 'string', 'someArg must be a string!')
})
}
myFunc('hoge')
}
tryExample().catch((err) => console.error(err))
API Guide
- module:@the-/check
See API Guide for more detail
License
This software is released under the MIT License.