# @blinkmobile/maybe-run

> Helper function to make dealing with nodejs error a little bit nicer

Latest version **1.0.2** (published 2018-05-17) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @blinkmobile/maybe-run
pnpm add @blinkmobile/maybe-run
yarn add @blinkmobile/maybe-run
bun add @blinkmobile/maybe-run
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2018-05-17 |
| First published | 2017-05-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8 |
| Dependencies | 0 |
| Unpacked size | 1.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Simon Dobie |
| Maintainers | blinkmobile-admin, k7n4n5t3w4rt, simon_marklar |
| Keywords | nodejs, error, callback, maybe |

## Links

- npm: https://www.npmjs.com/package/@blinkmobile/maybe-run
- Repository: https://github.com/blinkmobile/forms-cli/tree/master/packages/maybe-run
- npm.io page: https://npm.io/package/@blinkmobile/maybe-run

## Alternatives

- [@sentry/react-native](https://npm.io/package/@sentry/react-native.md) — 2.6M weekly downloads
- [@ardatan/aggregate-error](https://npm.io/package/@ardatan/aggregate-error.md) — 708.1K weekly downloads
- [custom-error-generator](https://npm.io/package/custom-error-generator.md) — 2.0K weekly downloads
- [@technik-sde/prosemirror-recreate-transform](https://npm.io/package/@technik-sde/prosemirror-recreate-transform.md) — 1.5K weekly downloads
- [@suchipi/error-utils](https://npm.io/package/@suchipi/error-utils.md) — 78 weekly downloads

## Recent versions

- 1.0.2 (latest) — 2018-05-17
- 1.0.0-alpha.1 — 2018-05-16
- 1.0.0-alpha.0 — 2017-05-12

## README

# 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


```javascript
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)
        })
      }
    })
  })
}
```

---
_Source: https://npm.io/package/@blinkmobile/maybe-run · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
