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.0.0-rc5 to 2.0.0

4

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

@@ -15,3 +15,3 @@ "main": "index.js",

"devDependencies": {
"acquit": "0.4.1",
"acquit": "0.5.1",
"gulp": "3.8.10",

@@ -18,0 +18,0 @@ "gulp-mocha": "2.0.0",

@@ -181,2 +181,29 @@ # kareem

#### It supports returning a promise
You can also return a promise from your pre hooks instead of calling
`next()`. When the returned promise resolves, kareem will kick off the
next middleware.
```javascript
hooks.pre('cook', function() {
return new Promise(resolve => {
setTimeout(() => {
this.bacon = 3;
resolve();
}, 100);
});
});
var obj = { bacon: 0 };
hooks.execPre('cook', obj, function() {
assert.equal(3, obj.bacon);
done();
});
```
## post hooks

@@ -381,1 +408,23 @@

## merge()
#### It pulls hooks from another Kareem object
```javascript
var k1 = new Kareem();
var test1 = function() {};
k1.pre('cook', test1);
k1.post('cook', function() {});
var k2 = new Kareem();
var test2 = function() {};
k2.pre('cook', test2);
var k3 = k2.merge(k1);
assert.equal(k3._pres['cook'].length, 2);
assert.equal(k3._pres['cook'][0].fn, test2);
assert.equal(k3._pres['cook'][1].fn, test1);
assert.equal(k3._posts['cook'].length, 1);
```
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