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.4.2 to 3.7.2

8

index.js

@@ -85,2 +85,6 @@ var util = require('util')

functor.and.not = function(predicate) {
return functor.and(not(predicate))
}
functor.or = function(fn) {

@@ -99,2 +103,6 @@ var predicate = clauses.pop()

functor.or.not = function(predicate) {
return functor.or(not(predicate))
}
functor.else = function(predicate) {

@@ -101,0 +109,0 @@ if (fluentState === EXPECT_THEN) {

2

package.json
{
"name": "if-async",
"description": "",
"version": "3.4.2",
"version": "3.7.2",
"keywords": [

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

@@ -135,2 +135,5 @@ # if-async [![Build Status](https://secure.travis-ci.org/kessler/if-async.png?branch=master)](http://travis-ci.org/kessler/if-async)

#### .and.not(Function)
same as and() only negate the result of the predicate
#### .or(Function)

@@ -142,2 +145,5 @@ ```javascript

#### .or.not(Function)
same as or() only negate the result of the predicate
#### .elseIf(Function)

@@ -151,3 +157,3 @@ ```javascript

#### .elseIf.not(Function)
same as elseIf only negate the result of the predicate
same as elseIf() only negate the result of the predicate

@@ -154,0 +160,0 @@ #### .else(Function)

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

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

@@ -389,2 +416,30 @@

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

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