{"id":19179277,"url":"https://github.com/royalgarter/sync-es6","last_synced_at":"2026-06-11T21:33:12.095Z","repository":{"id":65374315,"uuid":"92828863","full_name":"royalgarter/sync-es6","owner":"royalgarter","description":"How to write in sync (with only generator \u0026 yield ES6), based on waitfor-ES6","archived":false,"fork":false,"pushed_at":"2017-08-31T05:11:06.000Z","size":17,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-27T11:02:28.652Z","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/royalgarter.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-05-30T12:06:55.000Z","updated_at":"2017-06-03T13:59:06.000Z","dependencies_parsed_at":"2023-01-20T01:15:42.034Z","dependency_job_id":null,"html_url":"https://github.com/royalgarter/sync-es6","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/royalgarter/sync-es6","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/royalgarter%2Fsync-es6","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/royalgarter%2Fsync-es6/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/royalgarter%2Fsync-es6/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/royalgarter%2Fsync-es6/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/royalgarter","download_url":"https://codeload.github.com/royalgarter/sync-es6/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/royalgarter%2Fsync-es6/sbom","scorecard":{"id":785781,"data":{"date":"2025-08-11","repo":{"name":"github.com/royalgarter/sync-es6","commit":"ce8d176f2f2a6d6e86398b29100c8c63ad1b8244"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.3,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/16 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":"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":"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":"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":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"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":"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":"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":"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":"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":"Vulnerabilities","score":0,"reason":"20 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw","Warn: Project is vulnerable to: GHSA-qrmc-fj45-qfc2","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-44pw-h2cw-w3vq","Warn: Project is vulnerable to: GHSA-jp4x-w63m-7wgm","Warn: Project is vulnerable to: GHSA-c429-5p7v-vgjp","Warn: Project is vulnerable to: GHSA-896r-f27r-55mw","Warn: Project is vulnerable to: GHSA-fvqr-27wr-82fm","Warn: Project is vulnerable to: GHSA-4xc9-xhrj-v574","Warn: Project is vulnerable to: GHSA-x5rq-j2xg-h7qm","Warn: Project is vulnerable to: GHSA-jf85-cpcp-j695","Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-2m39-62fm-q8r3","Warn: Project is vulnerable to: GHSA-mf6x-7mm4-x2g7","Warn: Project is vulnerable to: GHSA-g7q5-pjjr-gqvp","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-23T06:04:04.943Z","repository_id":65374315,"created_at":"2025-08-23T06:04:04.943Z","updated_at":"2025-08-23T06:04:04.943Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34219510,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-11T02:00:06.485Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":"2024-11-09T10:42:38.649Z","updated_at":"2026-06-11T21:33:11.698Z","avatar_url":"https://github.com/royalgarter.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## About\n\nThe most native and simplest way to write-in-sync in NodeJS\n\nThis library is written purely in ES6 without any dependency\n\nStill non-blocking node's event loop\n\nFully compatible with all other libraries (such as [async](https://www.npmjs.com/package/async))\n\nNEW UPDATE: support Promise call (BETA - document pending) [Example](https://github.com/royalgarter/sync-es6/blob/master/test-promise.js)\n\n## Install\n\n* npm i sync-es6 --save\n\n## Usage\n\n**CALLBACK HELL**:\n\n```javascript\nmain(callback) {\n\tasync_function(arg1, (err, result1) =\u003e {\n\t\tanother_async_function(arg2, (err, result2) =\u003e {\n\t\t\treturn callback \u0026\u0026 callback(null, result1 + result2);\n\t\t});\n\t});\n}\n```\n\n**Step 0**: make sure all of your callback functions will be callbacked as \"function (err, result) {}\" format\n* 1st param: error indicated (usually null)\n* 2nd param: real return value\n\n**Step 1**: define wraper function as a generator function, and call inside functions in sync \n```javascript\nfunction* writeSyncInside(args1, args2) { \n\tlet returnValue1 = yield [async_function, arg1];\n\tlet returnValue2 = yield [another_async_function, arg2];\n\n\treturn returnValue1 + returnValue2;\n}\n```\n\n**Step 2**: CALL IT with sync\n```javascript\nconst _sync = require('sync-es6');\n\n_sync(writeSyncInside /*,args1, args2, ... , callback*/);\n// optional callback function at last argument, nice to have in case of error occurred\n```\n\n### Sample code:\n* [See here, it's very short I swear!!!](https://github.com/royalgarter/sync-es6/blob/master/test.js)\n\n### Syntax:\n\n```javascript\nlet iterator = _sync(runner,args1, args2, ... , finalcallback);\n```\n\n* Parameters\n\t* **runner** *(required)*: a generator function OR object ```{generator: function*, isTolerant: boolean}```\n\t    * **isTolerant** *(optional, default \"false\")*: if it's \"true\", when an error occurred in inside async function (when callback ```return (err)```) the runner will not throw \u0026 break to finalcallback (if existed) and just ```return undefined```\n\t* **args** *(optional)*: input params for generator function\n\t* **finalcallback** *(optional)*: catch error \u0026 final result for runner, if it's undefined the runner will throw() when error occurred\n\n* Return\n\t* **iterator** *(optional)*: IT'S NOT final result value, just a [iterator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). Normally you wouldn't use it. It has .break(err) method when you want to break from runner function anytime.\n\n```javascript\niterator.break(err) // break exit from inside runner (generator) function.\n```\n* Parameters\n\t* **err** *(required)*: Error/String/... anything that's not null\n\n### Credit:\n\nI write this library in thanks of Mr.Luciotato that looking into his code help me learn about generator function. I guess that because of he want the wait.for-es6 should be backward compatible with wait.for (ES5) so there something messy if you wall to call multiple async functions inside each others (with the \"onComplete\" event) OR maybe just I don't know how to use it properly. So I decide to seperate with a little modification to make it easier to use.\n* [wait.for-es6](https://www.npmjs.com/package/wait.for-es6) ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froyalgarter%2Fsync-es6","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Froyalgarter%2Fsync-es6","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froyalgarter%2Fsync-es6/lists"}