
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
NodeJS callback-based flow control utility library. Palinode focuses on a pure, dependency free, no-frills, native javascript implementation. Palinode is intentionally not compatible with browsers; it is intended for NodeJS only.
palinode (noun): a poem in which the poet retracts a view or sentiment expressed in a former poem. - source: Google.
npm install palinode
npm run test
npm run cover-html
const theFunctionToUse = require(`palinode`).theFunctionYouWant
As with the vast majority of native node libraries, all callbacks are by convention expected to be in the form:
function(error [, param1, param2, param3...]) {}
Error
prototype.Runs a series of functions. Each function calls back to the next. Any parameters passed to a callback are spread into the subsequent function call. The provided array of functions is not mutated.
var series = require('palinode').series;
var numToAddEachTime = 5;
function add(a, b, callback) {
callback(null, a + b, numToAddEachTime);
}
var functions = [
add.bind(null, 0, 0),
add,
add,
add
];
series(functions, function(error, result) {
console.log(result);
//outputs: 15
});
Runs a single function against each member of an array, invoking a callback when complete or when an error occurs during execution. If successful for each item in the input array, the result provided to the callback will be a new array containing the mapped values. If an error occurs, no data will be returned in the callback result. The input array is not mutated.
var mapEach = require('palinode').mapEach;
var inputArray = [1,2,3,4,5,6,7,8,9,10];
function square(input, callback) {
return callback(null, input * input);
}
mapEach(inputArray, square, function(error, result) {
console.log(result);
//outputs: [1,4,9,16,25,36,49,64,81,100]
});
All functions are expected to accept a callback in the form:
function(error, result) {}
Any parameters passed after result
are ignored.
var concurrent = require('palinode').concurrent;
function taskOfRandomDuration(number, callback) {
setTimeout(function() {
callback(null, number * number);
}, Math.floor((Math.random() * 3000) + 250));
}
var tasks = [
taskOfRandomDuration.bind(null, 2),
taskOfRandomDuration.bind(null, 4),
taskOfRandomDuration.bind(null, 8),
];
concurrent(tasks, function(err, res) {
console.log(res);
//outputs: [4, 16, 64]
});
Input functions are expected expected to have a signature:
function(inputItem, callback) {}
The function to run is expected to accept a callback in the form:
function(error, result) {}
var mapConcurrent = require('palinode').mapConcurrent;
function squareWithDelay(number, callback) {
setTimeout(function() {
callback(null, number * number);
}, Math.floor((Math.random() * 1500) + 150));
}
var inputItems = [1, 2, 3, 4, 5];
mapConcurrent(inputItems, squareWithDelay, function(err, res) {
console.log(res);
//outputs: [1, 4, 9, 16, 25]
});
var mapConcurrentAll = require('./lib/map-concurrent-all.js').mapConcurrentAll;
var inputs = [1, 2];
function iteratee(input, callback) {
if(input === 2) {
callback(new Error('2'));
} else {
callback(null, input)
}
}
mapConcurrentAll(inputs, iteratee, function(error, result){
console.log('NumErrors: ' + error);
console.log('Results: ' + JSON.stringify(result));
});
/*
NumErrors: 1
Results: [{
"error": null,
"result": 1
}, {
"error": {},
"result": null
}]
*/
FAQs
node callback-based flow control utility library
The npm package palinode receives a total of 18 weekly downloads. As such, palinode popularity was classified as not popular.
We found that palinode demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.