{"id":20208400,"url":"https://github.com/fluture-js/callgebra","last_synced_at":"2025-04-10T12:56:03.764Z","repository":{"id":57193197,"uuid":"163424074","full_name":"fluture-js/callgebra","owner":"fluture-js","description":"The little algebra of callbacks","archived":false,"fork":false,"pushed_at":"2021-04-06T13:20:43.000Z","size":56,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T11:44:49.296Z","etag":null,"topics":["algebraic-data-types","callbacks","functional-programming"],"latest_commit_sha":null,"homepage":null,"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/fluture-js.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-12-28T15:25:30.000Z","updated_at":"2022-09-18T18:28:03.000Z","dependencies_parsed_at":"2022-09-15T22:30:30.172Z","dependency_job_id":null,"html_url":"https://github.com/fluture-js/callgebra","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluture-js%2Fcallgebra","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluture-js%2Fcallgebra/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluture-js%2Fcallgebra/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluture-js%2Fcallgebra/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fluture-js","download_url":"https://codeload.github.com/fluture-js/callgebra/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247947856,"owners_count":21023066,"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":["algebraic-data-types","callbacks","functional-programming"],"created_at":"2024-11-14T05:35:26.214Z","updated_at":"2025-04-10T12:56:03.745Z","avatar_url":"https://github.com/fluture-js.png","language":"JavaScript","readme":"# Callgebra\n\nThe little algebra of callbacks.\n\n## Introduction\n\nThis package exports functions for composing callbacks. You can read\nabout the idea in my [Medium post about composable callbacks][1].\n\n## Usage\n\n### Node\n\n```console\n$ npm install --save callgebra\n```\n\nOn Node 12 and up, this module can be loaded directly with `import` or\n`require`. On Node versions below 12, `require` or the [esm][]-loader can\nbe used.\n\n```js\nimport {of, callback} from 'callgebra';\ncallback (console.log) (of (42));\n```\n\n### Deno and Modern Browsers\n\nYou can load the EcmaScript module from various content delivery networks:\n\n- [Skypack](https://cdn.skypack.dev/callgebra@2.1.0)\n- [JSPM](https://jspm.dev/callgebra@2.1.0)\n- [jsDelivr](https://cdn.jsdelivr.net/npm/callgebra@2.1.0/+esm)\n\n### Old Browsers and Code Pens\n\nThere's a [UMD][] file included in the NPM package, also available via\njsDelivr: https://cdn.jsdelivr.net/npm/callgebra@2.1.0/dist/umd.js\n\nThis file adds `flutureProject` to the global scope, or use CommonJS/AMD\nwhen available.\n\n```js\nconst {of, callback} = require ('callgebra');\ncallback (console.log) (of (42));\n```\n\n## API\n\n```hs\ntype Callback a b = (b -\u003e a) -\u003e a\n```\n\n#### \u003ca name=\"of\" href=\"https://github.com/fluture-js/callgebra/blob/v2.1.0/index.js#L57\"\u003e`of :: a -⁠\u003e Callback b a`\u003c/a\u003e\n\nCreates a callback for a given return value.\n\n#### \u003ca name=\"chain\" href=\"https://github.com/fluture-js/callgebra/blob/v2.1.0/index.js#L62\"\u003e`chain :: (a -⁠\u003e Callback c b) -⁠\u003e Callback c a -⁠\u003e Callback c b`\u003c/a\u003e\n\nSequence two callback-accepting functions.\n\n#### \u003ca name=\"map\" href=\"https://github.com/fluture-js/callgebra/blob/v2.1.0/index.js#L67\"\u003e`map :: (a -⁠\u003e b) -⁠\u003e Callback c a -⁠\u003e Callback c b`\u003c/a\u003e\n\nModify the return value of a callback.\n\n#### \u003ca name=\"ap\" href=\"https://github.com/fluture-js/callgebra/blob/v2.1.0/index.js#L72\"\u003e`ap :: Callback c (a -⁠\u003e b) -⁠\u003e Callback c a -⁠\u003e Callback c b`\u003c/a\u003e\n\nApply the function returned by one callback to the value returned by\nanother.\n\n#### \u003ca name=\"callback\" href=\"https://github.com/fluture-js/callgebra/blob/v2.1.0/index.js#L78\"\u003e`callback :: (a -⁠\u003e b) -⁠\u003e Callback b a -⁠\u003e b`\u003c/a\u003e\n\nGiven a function and a Callback, runs the Callback using the function.\n\n[1]: https://medium.com/@avaq/composable-callbacks-81c84f0324\n[esm]: https://github.com/standard-things/esm\n[UMD]: https://github.com/umdjs/umd\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffluture-js%2Fcallgebra","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffluture-js%2Fcallgebra","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffluture-js%2Fcallgebra/lists"}