{"id":13447926,"url":"https://github.com/staltz/zii","last_synced_at":"2025-04-07T16:17:54.370Z","repository":{"id":57406001,"uuid":"143053405","full_name":"staltz/zii","owner":"staltz","description":"Chain function calls using a prototype function z","archived":false,"fork":false,"pushed_at":"2021-01-29T13:58:06.000Z","size":9,"stargazers_count":230,"open_issues_count":1,"forks_count":4,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-31T15:18:11.693Z","etag":null,"topics":[],"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/staltz.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-07-31T18:39:44.000Z","updated_at":"2023-08-27T01:08:46.000Z","dependencies_parsed_at":"2022-09-11T23:12:20.366Z","dependency_job_id":null,"html_url":"https://github.com/staltz/zii","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/staltz%2Fzii","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/staltz%2Fzii/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/staltz%2Fzii/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/staltz%2Fzii/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/staltz","download_url":"https://codeload.github.com/staltz/zii/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247685628,"owners_count":20979085,"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":[],"created_at":"2024-07-31T05:01:30.541Z","updated_at":"2025-04-07T16:17:54.348Z","avatar_url":"https://github.com/staltz.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","📦 Legacy \u0026 Inactive Projects"],"sub_categories":[],"readme":"# zii\n\n**Chain function calls using a prototype function `.z()`**\n\nAdds a function `z` to the Object prototype so that you can right-compose functions together. This is like the [proposed pipeline operator `|\u003e`](https://github.com/tc39/proposal-pipeline-operator), but implemented in ES5.\n\n**`value.z(first).z(second)` is the same as `second(first(value))`**\n\n- 150 bytes small\n- Works with RxJS 6+\n- Works with Callbags\n- Works with plain functions and numbers and strings\n- Supports TypeScript\n\n## Installation\n\n```sh\nnpm install zii\n```\n\n## Usage\n\n```js\nrequire('zii');\n// Nothing else needed! This require will mutate the Object prototype\n```\n\nIf you use TypeScript, then add this to your `tsconfig.json` file:\n\n```\n{\n  ...\n  \"types\": [\n    \"node_modules/zii/index.d.ts\"\n  ]\n  ...\n}\n```\n\n## Examples\n\n### RxJS\n\n```js\nrequire('zii')\nconst {from} = require('rxjs')\nconst {map, filter} = require('rxjs/operators')\n\nfrom([1, 2, 3, 4, 5])\n  .z(filter(x =\u003e x % 2 === 1))\n  .z(map(x =\u003e x * 10))\n  .subscribe({\n    next: x =\u003e console.log(x)\n  })\n```\n\n### Callbags\n\n```js\nrequire('zii')\nconst {fromIter, map, filter, forEach} = require('callbag-basics')\n\nfromIter([1, 2, 3, 4, 5])\n  .z(filter(x =\u003e x % 2 === 1))\n  .z(map(x =\u003e x * 10))\n  .z(forEach(console.log))\n```\n\n### Simple JS\n\n```js\nfunction doubleSay(str) {\n  return str + ', ' + str;\n}\nfunction capitalize(str) {\n  return str[0].toUpperCase() + str.substring(1);\n}\nfunction exclaim(str) {\n  return str + '!';\n}\n\n'hello'\n  .z(doubleSay)\n  .z(capitalize)\n  .z(exclaim)\n  .z(console.log) // Hello, hello!\n```\n\n## License\n\n[MIT](LICENSE)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstaltz%2Fzii","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstaltz%2Fzii","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstaltz%2Fzii/lists"}