{"id":41479783,"url":"https://github.com/hasnat/promises-runner","last_synced_at":"2026-01-23T17:16:09.824Z","repository":{"id":52437511,"uuid":"95436231","full_name":"hasnat/promises-runner","owner":"hasnat","description":"Run promises from an array of objects waiting for some promises to be resolved before continuing running others","archived":false,"fork":false,"pushed_at":"2021-04-29T07:28:01.000Z","size":70,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-23T07:46:40.003Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hasnat.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-06-26T10:38:07.000Z","updated_at":"2021-04-29T07:27:38.000Z","dependencies_parsed_at":"2022-09-16T06:12:45.858Z","dependency_job_id":null,"html_url":"https://github.com/hasnat/promises-runner","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hasnat/promises-runner","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hasnat%2Fpromises-runner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hasnat%2Fpromises-runner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hasnat%2Fpromises-runner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hasnat%2Fpromises-runner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hasnat","download_url":"https://codeload.github.com/hasnat/promises-runner/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hasnat%2Fpromises-runner/sbom","scorecard":{"id":457362,"data":{"date":"2025-08-11","repo":{"name":"github.com/hasnat/promises-runner","commit":"c07d437d4285a5fedcef5005239fc3044e970e1d"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.6,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":0,"reason":"Found 0/19 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"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"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 4 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-19T10:04:17.906Z","repository_id":52437511,"created_at":"2025-08-19T10:04:17.906Z","updated_at":"2025-08-19T10:04:17.906Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28696523,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T15:57:05.722Z","status":"ssl_error","status_checked_at":"2026-01-23T15:56:27.656Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-23T17:16:09.138Z","updated_at":"2026-01-23T17:16:09.816Z","avatar_url":"https://github.com/hasnat.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# promises-runner\n\n[![Build Status](https://travis-ci.org/hasnat/promises-runner.svg)](https://travis-ci.org/hasnat/promises-runner)\n\n[![NPM](https://nodei.co/npm/promises-runner.png)](https://nodei.co/npm/promises-runner/)\n\nRun promises from an array of objects waiting for some promises to be resolved before continuing running others\n\n## Install\n\n    npm install --save promises-runner\n\n## Api\n```js\nPromisesRunner({\n    objectsArrayWithPromises: [Object],                 // default []\n    inputData: Object,                                  // default {}\n    outputDataKey: string|false,                        // default false\n    mergePromiseOutputToNextPromiseInput: true|false,   // default false\n    mergeSameKeyByConvertingToArray: true|false,        // default false\n    logger: Function|false         // default false\n    })\n```\nobjectsArrayWithPromises single object should be\n`{promise: (inputData) =\u003e Promise, wait: true|false, outputKey: string}`\n\n\nlogger function\n`logger: (action: String, objectFromArrayWithPromises: Object, inputOutputOrError: Mixed)`\n`action` = START|ERROR|DONE\n`objectFromArrayWithPromises` = one object from `objectsArrayWithPromises` with (`promiseName`)\n`inputOutputOrError` = would be input of promise if action = START,\n                     output of promise if action = DONE\n                     and error if action = ERROR\n\nCheck example logger function at end of README\n\n## Usage example\n\n```js\n\nvar PromisesRunner = require('promises-runner')\n\nfunction expensiveOperation(value) {\n  return Promise.resolve(value)\n}\nconst objectsArrayWithPromises = [\n    {promise: expensiveOperation},              // \u003c--┐\n    {promise: expensiveOperation},              // \u003c----- these will run in parallel\n    {promise: expensiveOperation},              // \u003c--┘\n    {promise: expensiveOperation, wait: true},  // this will wait before all previous are resolved\n    {promise: expensiveOperation},              // these 2 -- after the previous one is resolved\n    {promise: expensiveOperation},              // these 2 -- and are ran in parallel\n    {promise: expensiveOperation, wait: true},  // this will wait before all previous are resolved\n    {promise: expensiveOperation},              // these 2 -- after the previous one is resolved\n    {promise: expensiveOperation},              // these 2 -- and are ran in parallel\n]\nvar pr = new PromisesRunner({objectsArrayWithPromises});\n\npr.start();\n\n// pause/resume PromisesRunner\nconst resume = pr.pause();\nresume();\n\n// stop promises runner,\n// this will send currentOutput and\n// promise.then will be called after completion of promises already running (parallel ones)\nconst currentOutput = pr.stop();\n```\n\n### Example of objects being merged as per outputKey and mergePromiseOutputToNextPromiseInput\n```js\nconst sleepFor = (seconds, value, valueAs, d) =\u003e new Promise(resolve =\u003e (\n    setTimeout(() =\u003e resolve(value ? {[valueAs]: value} : {}), seconds)\n));\nconst allPromises = [\n            {promise: (d) =\u003e sleepFor(1, 'action1', 'a1', d)},\n            {promise: (d) =\u003e sleepFor(3, 'action2', 'a2', d)},\n            {promise: (d) =\u003e sleepFor(1, 'action3w', 'a3', d), wait: true},\n            {promise: (d) =\u003e sleepFor(8, 'action4', 'a4', d)},\n            {promise: (d) =\u003e sleepFor(1, 'action5', 'a5', d)},\n            {promise: (d) =\u003e sleepFor(2, 'action6w', 'a6', d), wait: true},\n            {promise: (d) =\u003e sleepFor(2, 'action7', 'a7', d)},\n            {promise: (d) =\u003e sleepFor(5, 'action8w', 'a8', d), wait: true},\n            {promise: (d) =\u003e sleepFor(2, 'action9', 'a9', d)},\n            {promise: (d) =\u003e sleepFor(1, 'action10', 'a10', d), outputKey: 'abc'},\n        ];\n\n        new PromisesRunner({\n            objectsArrayWithPromises: allPromises, \n            inputData: {someInputData: -1},\n            outputDataKey: 'outputKey',                 // default false\n            mergePromiseOutputToNextPromiseInput: true  // default false\n        })\n            .start()\n            .then(console.log)\n            \n/* \nfor outputDataKey = 'outputKey', mergePromiseOutputToNextPromiseInput = true\ninput for all promises: {someInputData: -1, outputKey: {a1: 'action1', a2: 'action2' ....}}\noutput: \n{\n    outputKey: { \n        a1: 'action1',\n        a2: 'action2',\n        a3: 'action3w',\n        a4: 'action4',\n        a5: 'action5',\n        a6: 'action6w',\n        a7: 'action7',\n        a8: 'action8w',\n        a9: 'action9',\n        abc: {\n            a10: 'action10'\n        }\n    }\n}\n*/\n/* \nfor outputDataKey = false, mergePromiseOutputToNextPromiseInput = true\ninput for all promises: {someInputData: -1, a1: 'action1', a2: 'action2' ....}\noutput: \n{\n    a1: 'action1',\n    a2: 'action2',\n    a3: 'action3w',\n    a4: 'action4',\n    a5: 'action5',\n    a6: 'action6w',\n    a7: 'action7',\n    a8: 'action8w',\n    a9: 'action9',\n    abc: {\n        a10: 'action10'\n    }\n}\n*/\n/* \nfor default outputDataKey = false, mergePromiseOutputToNextPromiseInput = false\ninput for all promises: {someInputData: -1}\noutput: \n{\n    a1: 'action1',\n    a2: 'action2',\n    a3: 'action3w',\n    a4: 'action4',\n    a5: 'action5',\n    a6: 'action6w',\n    a7: 'action7',\n    a8: 'action8w',\n    a9: 'action9',\n    abc: {\n        a10: 'action10'\n    }\n}\n*/\n```\n\n\nExample logger\n`taskLogger.js`\n```js\nconst chalk = require('chalk');\nconst lowerCase = require('lodash/lowerCase');\nconst pad = require('lodash/pad');\nmodule.exports = (action, relatedPromiseRunnerObject, relatedData) =\u003e {\n    let consoleColor = chalk;\n    switch (action) {\n        case 'START':\n            consoleColor = chalk.bgKeyword('orange');\n            break;\n        case 'DONE':\n            consoleColor = chalk.bgKeyword('green');\n            break;\n        case 'ERROR':\n            consoleColor = chalk.bgKeyword('red');\n            break;\n    }\n    console.log(consoleColor(`[${pad(action, 9)}]`), '==\u003e', lowerCase(relatedPromiseRunnerObject.promiseName));\n};\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhasnat%2Fpromises-runner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhasnat%2Fpromises-runner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhasnat%2Fpromises-runner/lists"}