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

listen

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

listen - npm Package Compare versions

Comparing version 0.3.0 to 0.3.1

listen-0.3.1.tgz

11

lib/listen.js

@@ -34,2 +34,9 @@ /**

} else {
while (offset < values.length - 1) {
if (values[offset] !== undefined) {
offset++;
} else {
values.splice(offset, 1);
}
}
fn(null, values);

@@ -70,2 +77,3 @@ }

function listener(fn, timeout) {
assertUnresolved();
if (typeof fn === 'number') {

@@ -75,4 +83,3 @@ timeout = fn;

}
assertUnresolved();
var index = offset + count++;
var index = offset + count++;
var callback = function (err, value) {

@@ -79,0 +86,0 @@ if (fn) {

4

package.json
{
"name" : "listen",
"version" : "0.3.0",
"version" : "0.3.1",
"description" : "Wait for the results of multiple callbacks",

@@ -21,3 +21,3 @@ "author" : "Maximilian Antoni (http://maxantoni.de)",

"urun" : "~0.0.6",
"sinon" : "~1.5.0",
"sinon" : "~1.6.0",
"uglify-js" : "~1.2.6",

@@ -24,0 +24,0 @@ "autolint" : "~1.0.4"

# listen.js
Wait for the results of multiple callbacks.
Wait for the results of multiple callbacks
Repository: https://github.com/mantoni/listen.js
[![Build Status](https://secure.travis-ci.org/mantoni/listen.js.png?branch=master)](http://travis-ci.org/mantoni/listen.js)
## Install
## Install on Node

@@ -76,6 +78,7 @@ ```

## Hacking
## Contrubuting
If you'd like to hack listen.js here is how to get started:
If you'd like to contribute to listen.js here is how to get started:
- Fork the project on GitHub.
- `npm install` will setup everything you need.

@@ -82,0 +85,0 @@ - `make` lints the code with JSLint and runs all unit tests.

@@ -116,3 +116,3 @@ /**

this.then(spy);
callback();
callback(); // undefined value is ignored.

@@ -175,2 +175,47 @@ sinon.assert.calledWith(spy, null, []);

'should not pass undefined from first value': function () {
var spy = sinon.spy();
var callbackA = this.listener();
var callbackB = this.listener();
var callbackC = this.listener();
callbackA();
callbackB(null, 'B');
callbackC(null, 'C');
this.then(spy);
sinon.assert.calledWith(spy, null, ['B', 'C']);
},
'should not pass undefined from second value': function () {
var spy = sinon.spy();
var callbackA = this.listener();
var callbackB = this.listener();
var callbackC = this.listener();
callbackA(null, 'A');
callbackB();
callbackC(null, 'C');
this.then(spy);
sinon.assert.calledWith(spy, null, ['A', 'C']);
},
'should not pass undefined from third value': function () {
var spy = sinon.spy();
var callbackA = this.listener();
var callbackB = this.listener();
var callbackC = this.listener();
callbackA(null, 'A');
callbackB(null, 'B');
callbackC();
this.then(spy);
sinon.assert.calledWith(spy, null, ['A', 'B']);
},
'should pass error to given function': function () {

@@ -177,0 +222,0 @@ var spy = sinon.spy();

Sorry, the diff of this file is not supported yet

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