Comparing version 1.0.5 to 1.1.0
@@ -5,2 +5,8 @@ ;(function(global) { | ||
var nextTick = function (fn) { setTimeout(fn, 0); } | ||
if (typeof process != 'undefined' && process && typeof process.nextTick == 'function') { | ||
// node.js and the like | ||
nextTick = process.nextTick; | ||
} | ||
function semaphore(capacity) { | ||
@@ -72,8 +78,8 @@ var semaphore = { | ||
if (typeof process != 'undefined' && process && typeof process.nextTick == 'function') { | ||
// node.js and the like | ||
process.nextTick(item.task); | ||
} else { | ||
setTimeout(item.task,0); | ||
} | ||
nextTick(item.task); | ||
}, | ||
available: function(n) { | ||
n = n || 1; | ||
return(semaphore.current + n <= semaphore.capacity); | ||
} | ||
@@ -80,0 +86,0 @@ }; |
{ | ||
"name": "semaphore", | ||
"version": "1.0.5", | ||
"version": "1.1.0", | ||
"description": "semaphore for node", | ||
@@ -5,0 +5,0 @@ "engines": { |
@@ -21,2 +21,5 @@ semaphore.js | ||
sem.leave([n]) | ||
// Available | ||
sem.available([n]) | ||
``` | ||
@@ -23,0 +26,0 @@ |
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
NPM Shrinkwrap
Supply chain riskPackage contains a shrinkwrap file. This may allow the package to bypass normal install procedures.
Found 1 instance in 1 package
8133
72
0
7
240
1