@the-/check-env

15.6.0 • Public • Published

@the-/check-env

npm Version

Check utility for the-framework

Installation

$ npm install @the-/check-env --save

Usage

'use strict'

const {
  strict: { equal, ok },
} = require('assert')
const { unlessProduction } = require('@the-/check-env')

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

See API Guide for more detail

License

This software is released under the MIT License.

Links

Readme

Keywords

Package Sidebar

Install

npm i @the-/check-env

Weekly Downloads

1

Version

15.6.0

License

MIT

Unpacked Size

13.9 kB

Total Files

12

Last publish

Collaborators

  • okunishinishi