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

function-thread

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

function-thread - npm Package Compare versions

Comparing version 0.2.3 to 0.2.4

5

index.js
'use strict';
var os = require('os');

@@ -7,2 +8,3 @@ var _ = require('lodash');

var genericPool = require('generic-pool');
/**

@@ -45,2 +47,3 @@ * @param {Function} func

}, options || {});
if (options.usePool) {

@@ -63,2 +66,3 @@ var pool = genericPool.createPool({

}, options.pool);
return function (input) {

@@ -83,2 +87,3 @@ return pool.acquire().then(function(thread) {

}
return function (input) {

@@ -85,0 +90,0 @@ var thread = spawn(func);

2

package.json
{
"name": "function-thread",
"version": "0.2.3",
"version": "0.2.4",
"description": "Run the function in a separate thread",

@@ -5,0 +5,0 @@ "main": "index.js",

'use strict';
var childProcess = require('child_process');
var path = require('path');
/**

@@ -10,2 +12,3 @@ * @param func

var thread = childProcess.fork(path.join(__dirname, 'worker.js'));
thread.send({

@@ -15,5 +18,7 @@ type: 'function',

});
thread.resultHandler = function () {};
thread.errorHandler = function () {};
thread.exitHandler = function () {};
thread.sendData = function (data) {

@@ -26,2 +31,3 @@ this.send({

};
thread.onResult = function (handler) {

@@ -31,2 +37,3 @@ this.resultHandler = handler;

};
thread.onError = function (handler) {

@@ -36,2 +43,3 @@ this.errorHandler = handler;

};
thread.onExit = function (handler) {

@@ -41,2 +49,3 @@ this.exitHandler = handler;

};
thread.on('message', function (message) {

@@ -54,4 +63,6 @@ switch (message.type) {

});
thread.on('exit', thread.exitHandler);
return thread;
};
'use strict';
/**

@@ -12,2 +13,3 @@ * @param {*} err

}
process.send({

@@ -18,5 +20,8 @@ type: 'error',

}
var ___workerFunction;
process.on('uncaughtException', sendError);
process.on('unhandledRejection', sendError);
process.on('message', function(message) {

@@ -23,0 +28,0 @@ switch (message.type) {

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