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

semaphore

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

semaphore - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

.travis.yml

15

lib/semaphore.js

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

var util = require('util');
'use strict';

@@ -6,3 +6,3 @@ module.exports = function(capacity) {

capacity: capacity || 1,
current: 0,
current: 0,
queue: [],

@@ -13,4 +13,7 @@

if (typeof arguments[0] == 'function') item.task = arguments[0];
else item.n = arguments[0];
if (typeof arguments[0] == 'function') {
item.task = arguments[0];
} else {
item.n = arguments[0];
}

@@ -52,3 +55,3 @@ if (arguments.length >= 2) {

semaphore.queue = semaphore.queue.splice(1);
semaphore.queue.shift();
semaphore.current += item.n;

@@ -60,3 +63,3 @@

return semaphore
return semaphore;
};

32

package.json
{
"name": "semaphore",
"version": "1.0.1",
"description": "semaphore for node",
"engine": "node >= 0.6.0",
"main": "./lib/semaphore.js",
"dependencies": {
},
"devDependencies": {
"mocha": "1.0.x",
"should": "0.6.x"
},
"homepage": "https://github.com/abrkn/semaphore.js"
}
"name": "semaphore",
"version": "1.0.2",
"description": "semaphore for node",
"engine": "node >= 0.6.0",
"main": "./lib/semaphore.js",
"dependencies": {},
"devDependencies": {
"mocha": "1.0.x",
"should": "0.6.x"
},
"homepage": "https://github.com/abrkn/semaphore.js",
"repository": {
"type": "git",
"url": "git@github.com:abrkn/semaphore.js.git"
},
"scripts": {
"test": "mocha"
}
}
semaphore.js
============
[![Build Status](https://travis-ci.org/abrkn/semaphore.js.svg?branch=master)](https://travis-ci.org/abrkn/semaphore.js)
Install:

@@ -61,2 +63,7 @@ npm install semaphore

});
```
```
License
===
MIT

@@ -144,3 +144,3 @@ var should = require('should');

describe("should respect number", function() {
it(function(done) {
it("should fail when taking more than the capacity allows", function(done) {
var s = semaphore(1);

@@ -155,3 +155,3 @@

it(function(done) {
it("should work fine with correct input values", function(done) {
var s = semaphore(10); // 10

@@ -163,6 +163,8 @@

s.take(5, done); // 0
s.take(5, function() {
return done()
}); // 0
});
});
});
});
});

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