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

node-fibers-synchronize-helper

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-fibers-synchronize-helper - npm Package Compare versions

Comparing version 1.1.2 to 2.0.0

2

index.js

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

var sync = require('synchronize');
var sync = require('synchronize_f2');

@@ -3,0 +3,0 @@ var synchObj = function (that, returnParamsNameArr) {

{
"name": "node-fibers-synchronize-helper",
"version": "1.1.2",
"version": "2.0.0",
"description": "helper for synchronize promise and callback and manage variables on Fiber Thread as ThreadLocal",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "node test.js"
},
"dependencies": {
"synchronize": "2.0.0"
"synchronize_f2": "2.0.1"
},
"devDependencies": {
"mongodb": "^2.2.33"
},
"repository": {

@@ -18,17 +21,16 @@ "type": "git",

"nodejs",
"node",
"fiber",
"synchronize",
"promise",
"callback",
"helper",
"sync",
"avoid callback",
"callback hell",
"fiber thread",
"ThreadLocal",
"Java ThreadLocal",
"Underlying Fiber Thread Objects"
],
"node",
"fiber",
"synchronize",
"promise",
"callback",
"helper",
"sync",
"avoid callback",
"callback hell",
"fiber thread",
"ThreadLocal",
"Java ThreadLocal",
"Underlying Fiber Thread Objects"
],
"author": "davide.zaccheo@gmail.com",

@@ -35,0 +37,0 @@ "license": "ISC",

# node-fibers-synchronize-helper
This helper uses synchronize module (https://www.npmjs.com/package/synchronize) and helps to manage promises and callbacks, and manage variables on underlying Fiber Thread like Java ThreadLocal, **you will be able to synchronize callback and promises** and **develop syncronously as your did in Java** returning Objects and catch exceptions, and set-get Objects on your Fiber Thread as you did with Java **ThreadLocal**.
Note version 2.0.x:
updated Fibers version to 2.0.0 by synchronize_f2 module (just a synchronize fork with pointing to Fibers 2.0.0)

@@ -5,0 +7,0 @@

@@ -10,3 +10,3 @@ //TEST

var url = 'mongodb://localhost:27017/local';
var url = 'mongodb://localhost:27017/test';
console.log("CALLBACK")

@@ -18,10 +18,27 @@ MongoClient.connect(url, function (err, db) {

console.log("PROMISE")
MongoClient.connect(url).then(function (res) {
var collection = res.collection('test_correctly_access_collections2');
assert.notEqual(null, collection);
var insertDocuments = function(db, callback) {
// Get the documents collection
var collection = db.collection('documents');
// Insert some documents
collection.insertMany([
{a : 1}, {a : 2}, {a : 3}
], function(err, result) {
assert.equal(err, null);
assert.equal(3, result.result.n);
assert.equal(3, result.ops.length);
console.log("Inserted 3 documents into the collection");
callback(result);
});
}
}).catch(function (err) {
// console.log("err:" + err);
})
MongoClient.connect(url, function(err, db) {
assert.equal(null, err);
console.log("Connected successfully to server");
insertDocuments(db, function() {
db.close();
});
});
console.log("SYNCH")

@@ -28,0 +45,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