Skip to content

Provide simple checks of method parameters on NodeJS

License

Notifications You must be signed in to change notification settings

superfaz/ensure-params

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ensure-params

Provide simple checks for method / function parameters.

installation

npm install --save ensure-params

usage

const ensure = require('ensure-params')

class HelloSomeone {
  static print (name) {
    ensure.param('name', name)
      .isRequired()
      .isString()
    console.log('Hello ' + name)
  }
}

HelloSomeone.print('test') // will succeed
HelloSomeone.print() // will fail and throws an error
HelloSomeone.print(null) // will fail and throws an error
HelloSomeone.print(1) // will fail and throws an error

About

Provide simple checks of method parameters on NodeJS

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published