{"id":28240048,"url":"https://github.com/codefeathers/fuse","last_synced_at":"2025-07-14T11:08:28.508Z","repository":{"id":57103067,"uuid":"128387457","full_name":"codefeathers/fuse","owner":"codefeathers","description":"FunctionSelect: Select a function that passes a condition. A functional alternative to switch-case.","archived":false,"fork":false,"pushed_at":"2018-05-19T05:13:10.000Z","size":420,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-19T22:53:05.177Z","etag":null,"topics":["flow-control","function","functional","javascript","select","switch-case"],"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/codefeathers.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-04-06T11:40:59.000Z","updated_at":"2024-03-26T09:30:57.000Z","dependencies_parsed_at":"2022-08-20T23:20:39.076Z","dependency_job_id":null,"html_url":"https://github.com/codefeathers/fuse","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/codefeathers/fuse","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codefeathers%2Ffuse","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codefeathers%2Ffuse/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codefeathers%2Ffuse/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codefeathers%2Ffuse/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codefeathers","download_url":"https://codeload.github.com/codefeathers/fuse/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codefeathers%2Ffuse/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265281198,"owners_count":23739870,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["flow-control","function","functional","javascript","select","switch-case"],"created_at":"2025-05-19T03:12:28.999Z","updated_at":"2025-07-14T11:08:28.495Z","avatar_url":"https://github.com/codefeathers.png","language":"JavaScript","readme":"# Fuse\n**FunctionSelect**\n\n`Fuse` selects a function that passes a condition.\n\n## Usage\n\n### Fuse\n\n```JavaScript\nconst Fuse = require('@codefeathers/fuse');\n\nconst a = 100;\n\nconst result = new Fuse(a)\n\t.on(x =\u003e x\u003e10,\n\t\ta =\u003e `${a} is greater than 10.`)\n\t.on(x =\u003e x\u003c10,\n\t\ta =\u003e `${a} is lesser than 10.`)\n\t.on(x =\u003e x===10,\n\t\ta =\u003e `${a} is 10.`)\n\nconsole.log(result.resolve()); // -\u003e \"100 is greater than 10.\"\n```\n\n### FuseIterable\n\n```JavaScript\nconst { FuseIterable } = require('@codefeathers/fuse');\n\nconst temperatures = [ 0, 20, 30 ];\n\nconst result = new FuseIterable(temperatures)\n\t.on(temp =\u003e temp\u003c10,\n\t\t() =\u003e `Too cold!`)\n\t.on(temp =\u003e temp\u003e=10 \u0026\u0026 temp \u003c25,\n\t\t() =\u003e `Just right.`)\n\t.on(temp =\u003e temp\u003e=25,\n\t\t() =\u003e `Too warm!`)\n\nconsole.log(result.resolve()); // -\u003e [ \"Too cold!\", \"Just right.\", \"Too warm!\" ]\n```\n\n## Docs\n\nDocs exist in `/docs` directory. Will be served soon.\n\n## Development\n\n\u003e If you find any mistakes in code/documentation, or if you feel something could be done better, do PR :)  I appreciate it.\n\n- Always write test spec for any code you add. Make sure they run as intended.\n- Add/update JSDoc comments as needed.\n- Use npm scripts for linting, tests, debugging, building docs.\n\nPlace your test file as `testscript.js` in root.\n\nThe following npm scripts are available: `npm run lint`, `npm test`, `npm run debug`, `npm run docs`.\n\n## Credits\n\n[@Floofies](https://github.com/Floofies) was of huge help during development of this module.\n\nAlso, [@TRGWII](https://github.com/trgwii) was a source of inspiration and guidance.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodefeathers%2Ffuse","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodefeathers%2Ffuse","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodefeathers%2Ffuse/lists"}