This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

@blinkmobile/maybe-run

1.0.2 • Public • Published

Maybe run

This is not the Maybe Monad, it is a utility to make working with Promises and NodeJS callback errors a little nicer.

Usage

const maybeRun = require('@blinkmobile/maybe-run')

function writeFileContents (p, contents) {
  return new Promise((resolve, reject) => {
    const notError = maybeRun(reject)
    const dirname = path.dirname(p)

    mkdirp(dirname, (err) => {
      if (notError(err)) {
        fs.writeFile(p, contents, (err) => {
          notError(err) && resolve(p)
        })
      }
    })
  })
}

Package Sidebar

Install

npm i @blinkmobile/maybe-run

Weekly Downloads

1

Version

1.0.2

License

MIT

Unpacked Size

1.18 kB

Total Files

3

Last publish

Collaborators

  • aaronroworth
  • blinkmobile-admin
  • kizaonline
  • mymattcarroll
  • simon_marklar