![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
promise-util-task
Advanced tools
npm i promise-util-task
sequentially processing
var task = require('promise-util-task');
var timeout = function(callback, ms) {
return new Promise(function(resolve, reject) {
setTimeout(function() {
resolve(callback());
}, ms);
});
};
var tasklist = [
function(){return timeout(function(){return 1}, Math.random() + 1000)},
function(){return timeout(function(){return 2}, Math.random() + 1000)},
function(){return timeout(function(){return 3}, Math.random() + 1000)},
function(){return timeout(function(){return 4}, Math.random() + 1000)},
function(){return timeout(function(){return 5}, Math.random() + 1000)},
function(){return timeout(function(){return 6}, Math.random() + 1000)},
function(){return timeout(function(){return 7}, Math.random() + 1000)},
function(){return timeout(function(){return 8}, Math.random() + 1000)},
function(){return timeout(function(){return 9}, Math.random() + 1000)},
function(){return timeout(function(){return 10}, Math.random() + 1000)}
];
console.time("elapsed time - seq");
task.seq(tasklist).then(function(res){
console.timeEnd("elapsed time - seq");
console.log(res);
})
elapsed time - seq: 10033ms
[ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]
parallel processing
var task = require('promise-util-task');
var timeout = function(callback, ms) {
return new Promise(function(resolve, reject) {
setTimeout(function() {
resolve(callback());
}, ms);
});
};
var tasklist = [
function(){return timeout(function(){return 1}, Math.random() + 1000)},
function(){return timeout(function(){return 2}, Math.random() + 1000)},
function(){return timeout(function(){return 3}, Math.random() + 1000)},
function(){return timeout(function(){return 4}, Math.random() + 1000)},
function(){return timeout(function(){return 5}, Math.random() + 1000)},
function(){return timeout(function(){return 6}, Math.random() + 1000)},
function(){return timeout(function(){return 7}, Math.random() + 1000)},
function(){return timeout(function(){return 8}, Math.random() + 1000)},
function(){return timeout(function(){return 9}, Math.random() + 1000)},
function(){return timeout(function(){return 10}, Math.random() + 1000)}
];
console.time("elapsed time - all");
task.all(tasklist).then(function(res){
console.timeEnd("elapsed time - all");
console.log(res);
})
elapsed time - all: 1007ms
[ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]
limited parallel processing
var task = require('promise-util-task');
var timeout = function(callback, ms) {
return new Promise(function(resolve, reject) {
setTimeout(function() {
resolve(callback());
}, ms);
});
};
var tasklist = [
function(){return timeout(function(){return 1}, Math.random() + 1000)},
function(){return timeout(function(){return 2}, Math.random() + 1000)},
function(){return timeout(function(){return 3}, Math.random() + 1000)},
function(){return timeout(function(){return 4}, Math.random() + 1000)},
function(){return timeout(function(){return 5}, Math.random() + 1000)},
function(){return timeout(function(){return 6}, Math.random() + 1000)},
function(){return timeout(function(){return 7}, Math.random() + 1000)},
function(){return timeout(function(){return 8}, Math.random() + 1000)},
function(){return timeout(function(){return 9}, Math.random() + 1000)},
function(){return timeout(function(){return 10}, Math.random() + 1000)}
];
console.time("elapsed time - limit");
task.limit(tasklist, 5).then(function(res){
console.timeEnd("elapsed time - limit");
console.log(res);
})
elapsed time - limit: 2009ms
[ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]
import * as put from 'promise-util-task'
import * as psleep from '@you21979/promise-sleep'
const list = [
() => psleep(Math.random() + 1000, 1),
() => psleep(Math.random() + 1000, 2),
() => psleep(Math.random() + 1000, 3),
() => psleep(Math.random() + 1000, 4),
() => psleep(Math.random() + 1000, 5),
() => psleep(Math.random() + 1000, 6),
() => psleep(Math.random() + 1000, 7),
() => psleep(Math.random() + 1000, 8),
() => psleep(Math.random() + 1000, 9),
() => psleep(Math.random() + 1000, 10)
]
console.time("elapsed time - seq");
put.seq(list).then((res) => {
console.timeEnd("elapsed time - seq");
console.log(res)
})
This module removed bluebird from version 0.1.0
rewrite typescript.
FAQs
task manager for promise
We found that promise-util-task 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.