Installations
npm install async-box
Developer
YuriSolovyov
Developer Guide
Module System
CommonJS
Min. Node Version
Typescript Support
No
Node Version
4.2.0
NPM Version
2.14.7
Statistics
34 Commits
3 Watching
1 Branches
1 Contributors
Updated on 17 Jun 2016
Languages
JavaScript (99.59%)
HTML (0.41%)
Total Downloads
Cumulative downloads
Total Downloads
4,018
Last day
0%
7
Compared to previous day
Last week
600%
7
Compared to previous week
Last month
1,000%
11
Compared to previous month
Last year
-51.9%
166
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dev Dependencies
4
Async-Box
AsyncBox is a library for your main application
object, it supports Sync and Async APIs
Requires runtime with Map
and Promise
APIs available.
Node 4+ and evergreen browsers are the best option.
Promise
can be polifilled with Bluebird library.
App object provides own API plus evented EventEmitter
API
Install:
npm install async-box
Use:
1// create app object 2var AsyncBox = require('async-box'); 3var app = new AsyncBox();
Async API:
1app.respondAsync('some-request-name', function(requestData) { 2 // response can be any plain JavaScript value, object or ... 3 return 'response-text'; 4}); 5 6app.respondAsync('async-promise-request', function(requestData) { 7 // ... or Promise 8 return new Promise(function(resolve, reject) { 9 resolve('response-promise'); 10 }); 11}); 12 13app.requestAsync('some-request-name').then(function(response) { 14 console.log(response); // -> 'response-text' 15}); 16 17app.requestAsync('async-promise-request').then(function(response) { 18 console.log(response); // -> 'response-promise' 19});
Sync API:
1app.respondSync('some-sync-request', function(request-data) { 2 // response is any valid JavaScript value 3 return 'some-response-value'; 4}); 5 6const response = app.requestSync('some-sync-request'); 7console.log(response); // -> 'some-response-value'
Batch API:
Async:
1app.respondAsync('request-type-one', function(requestData) { 2 console.log(requestData); // -> { key: 'some-value' } 3 // it could be any amount of code here, 4 // the main rule is to return a Promise 5 return new Promise(function(resolve, reject) { 6 resolve('one'); 7 }); 8}); 9 10app.respondAsync('request-type-two', function(requestData) { 11 console.log(requestData); // -> { key: 'other-value' } 12 return new Promise(function(resolve, reject) { 13 resolve('two'); 14 }); 15}); 16 17app.requestAllAsync([ 18 ['request-type-one', { key: 'some-value' }], 19 ['request-type-two', { key: 'other-value' }], 20]).then(function(results) { 21 console.log(results); // -> ['one', 'two'] 22});
Sync:
1app.respondSync('sync-request-one', function(requestData) { 2 console.log(requestData); // -> { key: 'sync-one' } 3 return 'sync-one'; 4}); 5 6app.respondSync('sync-request-two', function(requestData) { 7 console.log(requestData); // -> { key: 'sync-two' } 8 return 'sync-two'; 9}); 10 11const responses = app.requestAllSync([ 12 ['sync-request-one', { key: 'sync-one' }], 13 ['sync-request-two', { key: 'sync-two' }], 14]); 15 16console.log(responses); // ['sync-one', 'sync-two']
License
MIT © Yury Solovyov
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
- Info: project has a license file: License.md:0
- Info: FSF or OSI recognized license: MIT License: License.md: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
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
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Score
3
/10
Last Scanned on 2024-11-25
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 MoreOther packages similar to async-box
express-joi-validations
Express middleware to validate request (headers, params, query, body) using Joi
async
Higher-order functions and common patterns for asynchronous code
asyncro
Asynchronous Array Utilities (for await)
css-box-model
Get accurate and well named css box model information about an Element 📦