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

bbq

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bbq - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

14

index.js

@@ -1,2 +0,4 @@

var Q = require('q')
if (!('Promise' in this)) {
var Promise = require('bluebird')
}
var K = function (x) { return x }

@@ -12,7 +14,7 @@

advice.before = (advice.before || K(Q())).bind(state)
advice.after = (advice.after || K(Q())).bind(state)
advice.before = (advice.before || K(Promise.resolve())).bind(state)
advice.after = (advice.after || K(Promise.resolve())).bind(state)
// TODO: optimize cases
return Q(advice.before())
return Promise.cast(advice.before())
.then(function (val) {

@@ -22,6 +24,6 @@ // shortcircuit promiser

? val
: promiser()
: Promise.cast(promiser())
.then(function (val) {
state.val = val
return Q(advice.after())
return Promise.cast(advice.after())
.then(function (valAfter) {

@@ -28,0 +30,0 @@ // check for override promiser value

{
"name": "bbq",
"author": "jden <jason@denizac.org>",
"version": "0.1.0",
"version": "0.1.1",
"description": "AOP with Promises",

@@ -21,4 +21,4 @@ "keywords": [

"dependencies": {
"q": "~0.9.6"
"bluebird": "~0.11.5-0"
}
}
var chai = require('chai')
chai.should()
var Q = require('q')
var Promise = require('bluebird')

@@ -16,3 +16,3 @@ describe('bbq', function () {

bbq(function () {
return Q.promise(function (resolve) {
return new Promise(function (resolve) {
beforeCalled.should.equal(true)

@@ -51,3 +51,3 @@ afterCalled.should.equal(false)

bbq(function () {
return Q.promise(function (resolve, reject) {
return new Promise(function (resolve, reject) {
reject(new Error('promiser should not be called'))

@@ -78,3 +78,3 @@ })

bbq(function () {
return Q()
return Promise.resolve()
}, {

@@ -81,0 +81,0 @@ before: function () {

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