Skip to content

Ensure environment variable exists and convert to a number. If not, throw to fail early.

Notifications You must be signed in to change notification settings

stevemao/force-num

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ensure environment variable exists and convert to a number. If not, throw to fail early.

import forceNum from 'force-num'

const nodeEnv = forceNum('PORT')
// => 3000, or throw if not set or not a number

Related

  • force-env - Ensure environment variable exists. If not, throw to fail early.

About

Ensure environment variable exists and convert to a number. If not, throw to fail early.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published