2 const { ThreadWorker
} = require('poolifier')
4 function yourFunction (data
) {
5 if (data
.functionName
=== 'fn0') {
6 console
.log('Executing function 0')
7 return { data
: '0 your input was' + data
.input
}
8 } else if (data
.functionName
=== 'fn1') {
9 console
.log('Executing function 1')
10 return { data
: '1 your input was' + data
.input
}
14 module
.exports
= new ThreadWorker(yourFunction
)