
Security News
ESLint Adds Official Support for Linting HTML
ESLint now supports HTML linting with 48 new rules, expanding its language plugin system to cover more of the modern web development stack.
Call fn
, which returns a promise, on each item in array
, returning new array.
var q = require('q');
require('q-flow'); // extends q
var fn = function (each) {
return q.when(each + 1);
};
var array = [ 1, 2, 3 ];
q.map(array, fn).then(function (array) {
expect(array).to.deep.equal([ 2, 3, 4 ]);
});
Like map
except new array is not created.
Find first object in array
satisfying the condition returned by the promise returned by fn
.
var array = [ 1, 2, 3 ];
q.find(array, function (each) {
return q.fcall(function () {
return each === 2;
});
}).then(function (result) {
expect(result).to.equal(2);
});
Loop until the promise returned by fn
returns a truthy value.
q.until(function () {
return q.fcall(function () {
/* code which eventually returns true */
});
}).then(function (each) {
/* finished */
});
Allow one to place node-styled callback onto promise. This exits the promise run-loop so that it no longer catches exceptions.
promise.addBack(function (err, result) {
// gets `err` if failure happened, otherwise `result` is populated
});
FAQs
Flow control (loops, arrays, etc) with promises and Q.
We found that q-flow 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
ESLint now supports HTML linting with 48 new rules, expanding its language plugin system to cover more of the modern web development stack.
Security News
CISA is discontinuing official RSS support for KEV and cybersecurity alerts, shifting updates to email and social media, disrupting automation workflows.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.