New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

synchronize

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

synchronize - npm Package Compare versions

Comparing version 0.9.12 to 0.9.13

2

package.json
{
"name" : "synchronize",
"main" : "./sync",
"version" : "0.9.12",
"version" : "0.9.13",
"homepage" : "http://alexeypetrushin.github.com/synchronize",

@@ -6,0 +6,0 @@ "repository": {

@@ -17,2 +17,6 @@ synchronize.js allows You write asynchronous code as if it's synchronous.

Other resources:
-[Patterns and anti-patterns using synchronize.js](https://mixmax.com/blog/node-fibers-using-synchronize-js)
Copyright (c) Alexey Petrushin, http://petrush.in, released under the MIT license.

@@ -246,2 +246,12 @@ /*jshint node: true, indent:2, loopfunc: true, asi: true, undef:true*/

}finally{
// If neither `defer` nor `defers` were called within the callback, we need
// to run the fiber ourselves or else the fiber will unwind when `await` is called.
// This might happen if the user intended to enumerate an array within the
// callback, calling `defer` once per array item, but the array was empty.
if (!fiber._syncParallel.called) {
process.nextTick(function(){
// Return an empty array to represent that there were no results.
if(!fiber._syncIsTerminated) fiber.run([])
})
}
delete fiber._syncParallel

@@ -248,0 +258,0 @@ }

@@ -0,1 +1,3 @@

/*jshint node: true, indent:2, loopfunc: true, asi: true, undef:true, mocha: true */
// require('longjohn')

@@ -251,2 +253,12 @@

it('should not unwind when await is called after an empty parallel block', function(done){
sync.fiber(function(){
sync.parallel(function(){
// Imagine that the user intends to enumerate an array here, calling
// `defer` once per array item, but the array is empty.
})
expect(sync.await()).to.eql([])
}, done)
})
it('should return result from fiber', function(done){

@@ -253,0 +265,0 @@ sync.fiber(function(){

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