{"id":19728520,"url":"https://github.com/bsgbryan/madul","last_synced_at":"2026-02-28T19:01:56.187Z","repository":{"id":20430143,"uuid":"89896251","full_name":"bsgbryan/madul","owner":"bsgbryan","description":"Mädūl is the fun way to write functional code in TypeScript!","archived":false,"fork":false,"pushed_at":"2025-02-22T21:21:53.000Z","size":432,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-17T14:06:19.401Z","etag":null,"topics":["async","bun","fun","functional","functional-programming","module","module-system","typescript","typescript-library"],"latest_commit_sha":null,"homepage":"https://madul.dev","language":"TypeScript","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/bsgbryan.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-05-01T04:06:17.000Z","updated_at":"2025-02-22T21:21:56.000Z","dependencies_parsed_at":"2024-03-01T01:47:28.286Z","dependency_job_id":"f620c711-67d2-4e38-90fd-a8546259c5b9","html_url":"https://github.com/bsgbryan/madul","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/bsgbryan/madul","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bsgbryan%2Fmadul","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bsgbryan%2Fmadul/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bsgbryan%2Fmadul/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bsgbryan%2Fmadul/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bsgbryan","download_url":"https://codeload.github.com/bsgbryan/madul/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bsgbryan%2Fmadul/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260567246,"owners_count":23029068,"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":["async","bun","fun","functional","functional-programming","module","module-system","typescript","typescript-library"],"created_at":"2024-11-12T00:01:44.595Z","updated_at":"2025-11-01T06:03:49.014Z","avatar_url":"https://github.com/bsgbryan.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mädūl\n\nMadul is a simple set of tools that help you craft clean functional code that's straightforward to test - and fun to write \u0026 maintain\n\n# Docs\n\nYou can find a [Getting Started Guide](https://madul.dev/docs/padawan) and more [here](https://madul.dev) - enjoy! 🤘🏻\n\n## tl;dr\n\n### Madul Definition: `MessageReciever.ts`\n\n```ts\nexport const dependencies = () =\u003e ({\n  '+/db': ['connectAs', 'getAllMessagesBefore', 'getMessagesFrom']\n})\n\nexport const $init = async ({ connectAs, username }) =\u003e await connectAs({ username })\n\nexport const getMessagesFrom = async ({\n  friend,\n  getAllMessagesBefore,\n  getMessagesFrom,\n  sentBefore,\n}) =\u003e {\n  const allMessages  = await getAllMessagesBefore({ timestamp: sentBefore })\n  const fromMyFriend = await getMessagesFrom({ friend })\n\n  return allMessages.filter(m =\u003e fromMyFriend.includes(m))\n}\n```\n\n#### In the above code:\n\n1. A madul is just a plain old node module\n1. The `db` dependency is loaded asynchronously\n1. Dependencies are passed as named parameters to methods\n1. The `$init` method is guaranteed to be executed after all dependencies have been loaded, but before the madul is available for use; so you know that the `db` will be properly setup and connected to as `username`\n\n### Madul Usage `GetMessagesFromAda.ts`\n\n```ts\nimport madul from '@bsgbryan/madul'\n\nconst receiver = await madul('+/MessageReciever', { username: 'KatherineJohnson' })\n\nconst oneHour    = 1000 * 60 * 60\nconst sentBefore = Date.now() - oneHour\n\nconst messages = await receiver.getMessagesFrom({ friend: 'Ada', sentBefore })\n\nconsole.log('My messages from Ada!', messages)\n```\n\n#### In the above code:\n\n1. We pass the `username` used for connecting to the `db` when creating our `madul`\n1. We don't call `$init` directly; that's handled for us as part of `madul`\n1. We don't pass the `db` dependency to `getMessagesFrom`; that's handled for us\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbsgbryan%2Fmadul","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbsgbryan%2Fmadul","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbsgbryan%2Fmadul/lists"}