Installations
npm install taskling
Developer Guide
Typescript
No
Module System
CommonJS
Min. Node Version
>=10
Node Version
14.17.0
NPM Version
6.14.13
Score
64.9
Supply Chain
96.8
Quality
75.4
Maintenance
100
Vulnerability
100
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Love this project? Help keep it running — sponsor us today! 🚀
Developer
elidoran
Download Statistics
Total Downloads
2,978
Last Day
1
Last Week
11
Last Month
33
Last Year
284
GitHub Statistics
59 Commits
2 Watching
1 Branches
1 Contributors
Bundle Size
673.00 B
Minified
386.00 B
Minified + Gzipped
Package Meta Information
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
Total Downloads
Cumulative downloads
Total Downloads
2,978
Last day
0%
1
Compared to previous day
Last week
450%
11
Compared to previous week
Last month
371.4%
33
Compared to previous month
Last year
21.4%
284
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
1
Dev Dependencies
5
taskling
Small simple async function series with prepend/append/clear during run.
Features:
- Provides a shared object to each task function
- execution ends when a task provides an error to the callback
- mutable task queue via
prepend()
,append()
,clear()
- Task arrays provided will be flattened.
- early termination by providing an error.
- last task can provide a result for the done callback.
- uses
process.nextTick
by default, can specifysetImmediate
or a custom executor.
Install
1npm install --save taskling
Usage
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)
map+require
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})
MIT License
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
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 SAST tool detected
Details
- Warn: no pull requests merged into dev branch
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
13 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92
- Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-896r-f27r-55mw
- Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h
- Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp
- Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3
- Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7
Score
1.7
/10
Last Scanned on 2025-02-03
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