This package has been deprecated

Author message:

Use async/await instead

nitroglycerin

1.1.2 • Public • Published

Nitroglycerin

Circle CI Dependency Status Coverage Status

Makes JavaScript functions so volatile and explosive that they immediately throw on errors.

This is mostly useful for testing and simple command-line scripts. In production you most likely don't want to throw exceptions.

How it works

Let's say you have a small piece of test code that needs to set something up:

resetDatabase (err) ->
  if err then throw new Error(err)
  createUser name: 'Alfred Nobel'(err, alfred) ->
    if err then throw new Error(err)
    # run your tests using alfred here 

Checking that these calls didn't error out requires a bit of ceremony in Node.js, either in the form of manual error checking as described above, promises, or async.waterfall. Nitroglycerin removes most of this ceremony:

= require 'nitroglycerin'
 
resetDatabase N ->
  createUser name: 'Alfred Nobel'(alfred) ->
    # run your tests using alfred here 

The functions wrapped in Nitroglycerin will immediately throw an exception when they receive an error or execute the callback with the error argument stripped.

Development

See the developer documentation

Readme

Keywords

none

Package Sidebar

Install

npm i nitroglycerin

Weekly Downloads

23

Version

1.1.2

License

MIT

Last publish

Collaborators

  • hallettj
  • originate-owner
  • kevingoslar
  • charlierudolph