Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
An API to make looping over a series of async activities one at a time more straightforward.
Essentially it helps you code in a more synchronous manner than is convenient with many NodeJS libraries. Since much of Node's value is exactly it's async nature you should use with caution!
It is not the same promise.seq() in the node-promise, in that it is designed to work on a series of values through a chain of functions, rather than a single series of promise-returning functions.
You supply an array of initial values as the first argument to sheaf. Subsequent arguments should be functions that return either a value or a promise which resolves with a value. Starting with the values from the list, the output from each of function is given as the argument to the next. As each run through is complete, the next item in the list is used in the same way.
Sheaf itself returns a promise which resolves with an array of final values.
Here's a diagram of how it works:
$ npm install sheaf
// The list we will use.
var urls = ['a.html', 'b.html'];
// A promise-returning function
var getu = function(u) {
return $.get(u);
};
// A second promise returning function
// Note how it's a wrapper around a callback-based
// function.
var parse = function(data) {
dfd = new $.Deferred();
jsdom.env(data, [], function(win) {
dfd.resolve(win);
});
return dfd.promise();
};
// A synchronous value-returning function
var check = function(win) {
var val = false;
return win.$('p').each(function() {
if ( win.$(this).html().match(/^\s+/) ) {
val = true;
}
}
return val;
};
// Now, take the first item from `list`, run it through all the
// functions and when complete, take the second item and do the same
sheaf(urls, getu, parse, check)
.then(
function(allChecks) {
console.log('all finished', allChecks);
},
null, // nb - currently no management of rejected promises
function() {
console.log('there was some progress');
}
);
FAQs
Repeated promises
The npm package sheaf receives a total of 6 weekly downloads. As such, sheaf popularity was classified as not popular.
We found that sheaf 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.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.