Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

kareem

Package Overview
Dependencies
Maintainers
1
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kareem - npm Package Compare versions

Comparing version 2.3.2 to 2.3.3

5

CHANGELOG.md
# Changelog
<a name="2.3.3"></a>
## 2.3.3 (2021-12-26)
* fix: handle sync errors in `wrap()`
<a name="2.3.2"></a>

@@ -4,0 +9,0 @@ ## 2.3.2 (2020-12-08)

7

index.js

@@ -279,3 +279,8 @@ 'use strict';

const numParameters = fn.length;
const ret = fn.apply(context, args.slice(0, end).concat(_cb));
let ret;
try {
ret = fn.apply(context, args.slice(0, end).concat(_cb));
} catch (err) {
return _cb(err);
}

@@ -282,0 +287,0 @@ if (checkForPromise) {

2

package.json
{
"name": "kareem",
"version": "2.3.2",
"version": "2.3.3",
"description": "Next-generation take on pre/post function hooks",

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

@@ -322,2 +322,26 @@ var assert = require('assert');

it('catches sync errors', function(done) {
hooks.pre('cook', function(done) {
done();
});
hooks.post('cook', function(callback) {
callback();
});
var args = [];
args.push(function(error) {
assert.equal(error.message, 'oops!');
done();
});
hooks.wrap(
'cook',
function() {
throw new Error('oops!');
},
null,
args);
});
it('sync wrappers', function() {

@@ -324,0 +348,0 @@ var calledPre = 0;

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