{"id":50946558,"url":"https://github.com/jfet97/jducers","last_synced_at":"2026-06-17T20:38:37.012Z","repository":{"id":57279986,"uuid":"154658426","full_name":"jfet97/jducers","owner":"jfet97","description":"A js transducers-like implementation using ES9","archived":false,"fork":false,"pushed_at":"2019-02-28T14:23:23.000Z","size":35,"stargazers_count":23,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-06-17T20:38:35.380Z","etag":null,"topics":["async","asynchronous-programming","ecamscript2019","ecmascript","ecmascript2015","ecmascript2016","ecmascript2017","ecmascript2018","generator-functions","generators","hacktoberfest","hacktoberfest2018","javascript","javascript-library"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jfet97.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-10-25T11:19:23.000Z","updated_at":"2023-11-11T16:18:34.000Z","dependencies_parsed_at":"2022-09-19T19:01:41.680Z","dependency_job_id":null,"html_url":"https://github.com/jfet97/jducers","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jfet97/jducers","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jfet97%2Fjducers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jfet97%2Fjducers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jfet97%2Fjducers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jfet97%2Fjducers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jfet97","download_url":"https://codeload.github.com/jfet97/jducers/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jfet97%2Fjducers/sbom","scorecard":{"id":517411,"data":{"date":"2025-08-11","repo":{"name":"github.com/jfet97/jducers","commit":"3a0bb9315724d5180b10dd7ca8df17e5476e92ef"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"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":"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":"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":"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":"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":"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":"Code-Review","score":0,"reason":"Found 0/30 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":"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":"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":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"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"}}]},"last_synced_at":"2025-08-20T02:11:21.585Z","repository_id":57279986,"created_at":"2025-08-20T02:11:21.586Z","updated_at":"2025-08-20T02:11:21.586Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34465322,"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-17T02:00:05.408Z","response_time":127,"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":["async","asynchronous-programming","ecamscript2019","ecmascript","ecmascript2015","ecmascript2016","ecmascript2017","ecmascript2018","generator-functions","generators","hacktoberfest","hacktoberfest2018","javascript","javascript-library"],"created_at":"2026-06-17T20:38:35.807Z","updated_at":"2026-06-17T20:38:37.007Z","avatar_url":"https://github.com/jfet97.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jducers\nA js transducers-like implementation using generators and ES9 async generators.\n\nA composed function expecting a combination function to make a reducer is called **transducer**.\nTransducers are useful to compose adjacent **map()**, **filer()** and **reduce()** operations together to improve performaces.\n\nA **jducer** is similar to a transducer because it is a composed function and can be used to compose **map()**, **filter()** and **reduce()** operations together, but there are some differences.\n\nIt was a challenge against myself to see how far could I go using generators.\n\n## install\n\n```sh\n$ npm i --save jducers\n```\n\n## utility\nA little fp utility library used by jducers and available for you with **pipe**, **compose**, **curry**, **partial** and **partialRight**\n\n```js\nimport { pipe, compose, curry, partial, partialRight } from 'jducers/src/utility';\n```\n\n## sync\nSync's jducers helpers: \n\n```js\nimport { map, filter, reduce, run }  from 'jducers/src/jducers/sync'\n```\nor\n```js\nimport * as SJ from 'jducers/src/jducers/sync'\n```\n\n* **map**: accepts only a mapper function that is up to you and returns a function used in the creation of a **jducer**\n* **filter**: accepts only a predicate function that is up to you and returns a function used in the creation of a **jducer**\n* **reduce**: accepts two parameters: a reducer function with some constraints and an optional initial value and returns a function used in the creation of a **jducer**. The reducer function will be called with only two parameters: the accumulator and the current processed value\n* **run**: accepts two parameters: a composition (you can use **pipe** or **compose** from my utility library) and a sync iterable like an array. Returns the resuling array or a single value.It depends on the functions used in the composition\n\n```js\nimport * as SJ from 'jducers/src/jducers/sync'\nimport { pipe, partialRight } from 'jducers/src/utility';\n\nlet array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20];\n\nconst isOdd = i =\u003e !!(i % 2); // predicate function\nconst double = i =\u003e i * 2; // mapper function\nconst sum = (acc, val) =\u003e acc + val; // reducer\n\nconst syncIsOddFilter = SJ.filter(isOdd);\nconst syncDoubleMap = SJ.map(double);\nconst syncSumReduce = SJ.reduce(sum);\n\nconst run = partialRight(SJ.run, array);\n\nlet jducer = pipe(syncIsOddFilter, syncDoubleMap);\nlet res = run(jducer);\nconsole.log(res); // [2, 6, 10, 14, 18, 22, 26, 30, 34, 38]\n\njducer = pipe(syncIsOddFilter, syncDoubleMap, syncSumReduce);\nres = run(jducer);\nconsole.log(res); // 200\n```\n\n## async\nAsync's jducers helpers (useful for async iterables and concurrent async iterations): \n\n```js\nimport { map, filter, reduce, run, observerFactory }  from 'jducers/src/jducers/async'\n```\nor\n```js\nimport * as AJ from 'jducers/src/jducers/async'\n```\n\n* **map**: accepts only a mapper function that is up to you and returns a function used in the creation of a **jducer**\n* **filter**: accepts only a predicate function that is up to you and returns a function used in the creation of a **jducer**\n* **reduce**: accepts two parameters: a reducer function with some constraints and an optional initial value and returns a function used in the creation of a **jducer**. The reducer function will be called with only two parameters: the accumulator and the current processed value\n* **run**: accepts two parameters: a composition (you can use **pipe** or **compose** from my utility library) and an async iterable like an array of promises. Returns a promise that will be fulfilled with the resulting array or a single value. It depends on the functions used in the composition\n* **observerFactory**: accepts one or more callbacks and returns a simple observer that calls them when each single value of our async iterable flows through it. The observer has to be placed in a composition to form the **jducer**\n\n```js\nimport * as AJ from 'jducers/src/jducers/async'\nimport { pipe, partialRight } from 'jducers/src/utility';\n\nconst asyncArray = {\n    array: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],\n    [Symbol.asyncIterator]: async function* () {\n        for (const x of this.array) {\n            await new Promise(ok =\u003e setTimeout(() =\u003e ok(x), 2000));\n            yield x;\n        }\n    }\n}\n\nconst isOdd = i =\u003e !!(i % 2); // predicate function\nconst double = i =\u003e i * 2; // mapper function\nconst sum = (acc, val) =\u003e acc + val; // reducer\n\nconst asyncIsOddFilter = AJ.filter(isOdd);\nconst asyncDoubleMap = AJ.map(double);\nconst asyncSumReduce = AJ.reduce(sum);\n\nconst run = partialRight(AJ.run, asyncArray);\n\nlet jducer = pipe(asyncIsOddFilter, asyncDoubleMap);\nlet res = run(jducer); \nres.then(x =\u003e console.log(x)); // [2, 6, 10, 14, 18, 22, 26, 30, 34, 38]\n\njducer = pipe(asyncIsOddFilter, asyncDoubleMap, asyncSumReduce);\nres = run(jducer);\nres.then(x =\u003e console.log(x)); // 200\n\nconst observer = AJ.observerFactory(console.log);\n/*\n  const observer = observerFactory();\n  observer.add(console.log);\n*/\n  \njducer = pipe(observer, asyncDoubleMap, observer, asyncSumReduce);\n// we will see each value before and after the double mapper function\n// 1 2 2 4 3 6 4 8 5 10 6 12 ...\nres = run(jducer); \nres.then(x =\u003e console.log(x)); // 420\n\n// WARNING: OUTPUTS ARE IN CONCURRENCY\n```\n\n## weight\n\nAll modules and functions together are 3.284Kb **without** compression\n\n## performance\n\nBad, because **yield** is still an expensive operation\n\n## fun\n\nA lot! ES9 is so powerful, in few lines I created something very difficult to do before without a library\n\n## license\n\nMIT\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjfet97%2Fjducers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjfet97%2Fjducers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjfet97%2Fjducers/lists"}