Gathering detailed insights and metrics for taskling
Gathering detailed insights and metrics for taskling
Gathering detailed insights and metrics for taskling
Gathering detailed insights and metrics for taskling
Small simple async function series with prepend/append/clear during run.
npm install taskling
Typescript
Module System
Min. Node Version
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
59 Commits
1 Watchers
1 Branches
1 Contributors
Updated on Jun 29, 2021
Latest Version
2.0.0
Package Id
taskling@2.0.0
Unpacked Size
9.02 kB
Size
3.98 kB
File Count
5
NPM Version
6.14.13
Node Version
14.17.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
5
Small simple async function series with prepend/append/clear during run.
Features:
prepend()
, append()
, clear()
process.nextTick
by default, can specify setImmediate
or a custom executor.1npm install --save taskling
1const tasks = require('taskling') 2 3// create a shared object to hold data usable by all task functions: 4const shared = {} 5 6// create an array of functions (tasks) to run: 7const array = [ 8 // must always call the first arg, next(), when done. 9 function first(next) { next() }, 10 11 // second arg is the `shared` we provide to tasks() 12 function second(next, sharedObject) { next() }, 13 14 // the `this` context is a "control" object with helper functions: 15 function controlled(next, _, control) { 16 // prepend/append: 17 // - require an array argument. 18 // - accept nested arrays. 19 20 // add array of functions to run *next*, 21 // so they go in the front of the queue/array: 22 control.prepend([/* ... */]) 23 24 // same as prepend() except they are added to the end. 25 control.append([/* ... */]) 26 27 // empty the tasks array: 28 control.clear() 29 30 next() // always call next() 31 // last function can provide a result like this: 32 // next(null, theResult) 33 // the first arg is null for error. 34 }, 35] 36 37// a "done" function is called when tasks are done. 38// if an error is provided by a task then execution stops 39// and the "done" callback is called with the error as first arg. 40// if no error is provided, ever, then "done" is called last. 41function done(error, result) { 42 // do something with error, if it exists... 43 // otherwise, it was a success. 44 // get your results from the `sharedObject`, 45 // or, the last task can provide a `result` as the 2nd arg. 46} 47 48// now, use those three things to run the tasks: 49tasks(shared, array, done) 50 51// NOTE: 52// tasks() will always return immediately before it begins execution. 53// this is the standard behavior for asynchronous API's. 54// by default it calls each task via `process.nextTick()`. 55// to override that with setImmediate, pass it as the fourth arg. 56tasks(shared, array, done, setImmediate) 57 58 59// Succinct use: 60require('taskling')({ 61 // the shared object 62 }, [ 63 // the tasks array 64 ], 65 function(error, result) { 66 // the "done" callback 67 } 68)
I usually separate out my task functions into separate modules. Then, instead of writing require()
every for each one I use map(require)
on the array.
1var array = [ 2 'some-package', // some published package providing a task function 3 './some/module.js', // some local module providing a task function 4].map(require) 5 6// or in the whole thing as "succinct" version: 7require('taskling')({ 8 // shared object 9}, [ 10 'some-package', 11 './some/module.js', 12].map(require), function(error) { 13 // all done... 14})
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
no SAST tool detected
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
15 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More