New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

async-handlers

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

async-handlers - npm Package Compare versions

Comparing version 1.2.1 to 1.3.0

lib/constant.js

1

lib/index.js
// Generated by CoffeeScript 1.9.3
(function() {
module.exports = {
constant: require('./constant'),
exitOnError: require('./exit_on_error'),

@@ -5,0 +6,0 @@ extract: require('./extract'),

2

package.json
{
"name": "async-handlers",
"version": "1.2.1",
"version": "1.3.0",
"description": "Function factories for performing synchronous operations after asynchronous operations",

@@ -5,0 +5,0 @@ "main": "./lib/index.js",

# Asynchronous handlers
Function factories for performing synchronous operations after asynchronous operations
Function factories for performing synchronous operations after asynchronous operations.
#### transform(fn, callback)
Returns a function `(err, result)` that can be passed to an asynchronous function
that will pass the error through or pass `(null, fn(result))`
```js

@@ -32,5 +26,15 @@ f1 = function (callback) {

## Methods
#### constant(value, callback)
Returns a function with the signature `(err)`.
When called with an error, passes it to the callback.
Otherwise executes callback with `(null, value)`.
#### exitOnError
A function that when called with an error, prints the error in red to `stderr` and exits with status 1.
Returns a function with the signature `(err)`.
When called with an error, prints the error in red to `stderr` and exits with status 1.
Otherwise does nothing.

@@ -41,3 +45,21 @@

Returns a function `(err, result)` that can be passed to an asynchronous function
that will pass the error through or pass `(null, result[key])`
Returns a function with the signature `(err, result)`.
When called with an error, passes it to the callback.
Otherwise executes callback with `(null, result[key])`.
#### prependToError(prefix, callback)
Returns a function with the signature `(err, args...)`.
When error is a string, prepends prefix to it if and passes it to the callback.
When error is an object with a message property, prepends prefix to its message and passes it to the callback.
Otherwise passes all arguments to the callback.
_Note: the prefix will only be prepended if not already present._
#### transform(fn, callback)
Returns a function with the signature `(err, result)`.
When called with an error, passes it to the callback.
Otherwise executes callback with `(null, fn(result))`.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc