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

if-async

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

if-async - npm Package Compare versions

Comparing version 3.3.1 to 3.3.2

4

index.js

@@ -73,3 +73,3 @@ var util = require('util')

functor.and = function(fn) {
var predicate = clauses.shift()
var predicate = clauses.pop()
// logical AND using ifAsync

@@ -86,3 +86,3 @@ clauses.push(

functor.or = function(fn) {
var predicate = clauses.shift()
var predicate = clauses.pop()
// logical OR

@@ -89,0 +89,0 @@ clauses.push(

{
"name": "if-async",
"description": "",
"version": "3.3.1",
"version": "3.3.2",
"keywords": [

@@ -6,0 +6,0 @@ "async"

@@ -238,2 +238,34 @@ var ifAsync = require('./index.js')

})
it('ifAsync(p1 = false).then(c1).elseif(p2 = true).and(p3 = true).then(c2) should not invoke c1 and should invoke p1, p2 and p3', function(done) {
var c1Invoked = false
var c2Invoked = false
var p1Invoked = false
var p2Invoked = false
var p3Invoked = false
ifAsync(function p1(callback) {
p1Invoked = true
callback(null, false)
}).then(function c1(callback) {
c1Invoked = true
callback()
}).elseif(function p2(callback) {
p2Invoked = true
callback(null, true)
}).and(function p3(callback) {
p3Invoked = true
callback(null, true)
}).then(function c2(callback) {
c2Invoked = true
callback()
})(function(err) {
p1Invoked.should.be.true
c1Invoked.should.be.false
p2Invoked.should.be.true
p3Invoked.should.be.true
c2Invoked.should.be.true
done()
})
})
})

@@ -325,2 +357,34 @@

})
it('ifAsync(p1 = false).then(c1).elseif(p2 = false).or(p3 = true).then(c2) should not invoke c1 and should invoke p1, p2 and p3', function(done) {
var c1Invoked = false
var c2Invoked = false
var p1Invoked = false
var p2Invoked = false
var p3Invoked = false
ifAsync(function p1(callback) {
p1Invoked = true
callback(null, false)
}).then(function c1(callback) {
c1Invoked = true
callback()
}).elseif(function p2(callback) {
p2Invoked = true
callback(null, false)
}).or(function p3(callback) {
p3Invoked = true
callback(null, true)
}).then(function c2(callback) {
c2Invoked = true
callback()
})(function(err) {
p1Invoked.should.be.true
c1Invoked.should.be.false
p2Invoked.should.be.true
p3Invoked.should.be.true
c2Invoked.should.be.true
done()
})
})
})

@@ -327,0 +391,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