# safecallback

> Handle callback errors safely and easily

Latest version **1.0.1** (published 2013-03-27) · 0 weekly downloads

## Install

```sh
npm install safecallback
pnpm add safecallback
yarn add safecallback
bun add safecallback
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2013-03-27 |
| First published | 2013-03-27 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.4 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Bevry Pty Ltd |
| Maintainers | balupton |
| Keywords | callback, flow, async, errors, error |

## Links

- npm: https://www.npmjs.com/package/safecallback
- Repository: https://github.com/bevry/safecallback
- Issues: https://github.com/bevry/safecallback/issues
- npm.io page: https://npm.io/package/safecallback

## 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.1 (latest) — 2013-03-27
- 1.0.0 — 2013-03-27

## README

# SafeCallback [![Build Status](https://secure.travis-ci.org/bevry/safecallback.png?branch=master)](http://travis-ci.org/bevry/safecallback)

Handle asynchronous callback errors safely and easily

## Install

### Backend

1. [Install Node.js](http://bevry.me/node/install)
1. `npm install --save safecallback`

### Frontend

1. [See Browserify](http://browserify.org/)


## Usage

### JavaScript

``` javascript
// Before
var getFileContentsUpperCased = function(path,next){
	require('fs').readFile(path, function(err,data){
		if(err)  return next(err)  // annoying check
		return next(null, data.toString().toUpperCase())
	})
}

// After
var safeCallback = require('safecallback')
var getFileContentsUpperCased = function(path,next){
	require('fs').readFile(path, safeCallback(next, function(err,data){
		return next(null, data.toString().toUpperCase())
	}))
}
```

### CoffeeScript

``` coffeescript
# Before
getFileContentsUpperCased = (path,next) ->
	require('fs').readFile path, (err,data) ->
		return next(err)  if err  # annoying check
		return next(null, data.toString().toUpperCase())

# After
safeCallback = require('safecallback')
getFileContentsUpperCased = (path,next) ->
	require('fs').readFile path, safeCallback next, (err,data) ->
		return next(null, data.toString().toUpperCase())
```


## History
You can discover the history inside the [History.md](https://github.com/bevry/safecallback/blob/master/History.md#files) file


## License
Licensed under the incredibly [permissive](http://en.wikipedia.org/wiki/Permissive_free_software_licence) [MIT License](http://creativecommons.org/licenses/MIT/)
<br/>Copyright © 2013+ [Bevry Pty Ltd](http://bevry.me) <us@bevry.me>

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