{"id":13452073,"url":"https://github.com/hipstersmoothie/compose-tiny","last_synced_at":"2025-04-14T06:12:41.750Z","repository":{"id":33053931,"uuid":"150695739","full_name":"hipstersmoothie/compose-tiny","owner":"hipstersmoothie","description":"A very tiny and fast compose function.","archived":false,"fork":false,"pushed_at":"2022-12-08T19:14:34.000Z","size":2160,"stargazers_count":46,"open_issues_count":20,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-14T06:12:33.806Z","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/hipstersmoothie.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-09-28T06:30:39.000Z","updated_at":"2023-04-03T13:32:03.000Z","dependencies_parsed_at":"2023-01-14T23:12:44.809Z","dependency_job_id":null,"html_url":"https://github.com/hipstersmoothie/compose-tiny","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hipstersmoothie%2Fcompose-tiny","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hipstersmoothie%2Fcompose-tiny/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hipstersmoothie%2Fcompose-tiny/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hipstersmoothie%2Fcompose-tiny/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hipstersmoothie","download_url":"https://codeload.github.com/hipstersmoothie/compose-tiny/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248830398,"owners_count":21168272,"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-31T07:01:11.986Z","updated_at":"2025-04-14T06:12:41.729Z","avatar_url":"https://github.com/hipstersmoothie.png","language":"JavaScript","readme":"\u003cdiv align=\"center\"\u003e\n  \u003cimg width=\"200\" height=\"200\"\n    src=\"https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/240/apple/129/musical-score_1f3bc.png\"\u003e\n  \u003ch1\u003ecompose-tiny\u003c/h1\u003e\n  \u003cp\u003eA very tiny and fast compose function.\u003c/p\u003e\n\u003c/div\u003e\n\n[![CircleCI](https://img.shields.io/circleci/project/github/hipstersmoothie/compose-tiny/master.svg?style=for-the-badge)](https://circleci.com/gh/hipstersmoothie/compose-tiny/tree/master) [![Codecov](https://img.shields.io/codecov/c/github/hipstersmoothie/compose-tiny.svg?style=for-the-badge)](https://codecov.io/gh/hipstersmoothie/compose-tiny) [![npm](https://img.shields.io/npm/v/compose-tiny.svg?style=for-the-badge)](https://www.npmjs.com/package/compose-tiny) [![bundle size](http://img.badgesize.io/hipstersmoothie/compose-tiny/master/index.js.svg?style=for-the-badge)](https://www.npmjs.com/package/compose-tiny) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=for-the-badge)](https://github.com/prettier/prettier)\n\n\u003e Function composition is an act or mechanism to combine simple functions to build more complicated ones.\n\n`compose-tiny` aims to provide a simple function for composition at the smallest possible size and the fasted possible speed. It's TypeScript friendly too!\n\n## Installation\n\n```sh\nnpm install compose-tiny\n```\n\n## Usage\n\n```js\nconst compose = require('compose-tiny');\n\nconst add = x =\u003e x + 2;\nconst sqr = x =\u003e x ** 2;\n\nconst blastOff = compose(\n  x =\u003e `🚀 ${x} 🚀`\n  sqr,\n  add\n);\n\nblastOff(2);\n```\n\nOutput:\n\n```sh\n🚀 16 🚀\n```\n\n## Multiple Arguments\n\nThe first function in the composition can take multiple arguments.\n\n```js\nconst compose = require('compose-tiny');\n\nconst add = x =\u003e x + 2;\nconst sqr = x =\u003e x ** 2;\n\nconst blastOff = compose(\n  sqr,\n  add,\n  (x, y, z) =\u003e (x + y) * z\n);\n\nblastOff(1, 2, 4);\n```\n\n## Performance\n\nNOTE: bundlephobia measures all package files\n\n| NAME             | OPS/SEC  | RELATIVE MARGIN OF ERROR                      | SAMPLE SIZE | BUNDLE SIZE                                                |\n| ---------------- | -------- | --------------------------------------------- | ----------- | ---------------------------------------------------------- |\n| compose-tiny     | 1108,413 | ± 0.72%                                       | 187         | [112 B](https://bundlephobia.com/result?p=compose-tiny)     |\n| squad            | 105,070  | ± 0.62% | 185         | [517 B](https://bundlephobia.com/result?p=squad)            |\n| just-compose     | 46,964   | ± 1.88%                                       | 181         | [334 B](https://bundlephobia.com/result?p=just-compose)     |\n| chain-function   | 22,556   | ± 0.50%                                       | 187         | [341 B](https://bundlephobia.com/result?p=chain-function)   |\n| compose-function | 20,817   | ± 0.49%                                       | 186         | [1.2 kB](https://bundlephobia.com/result?p=compose-function) |\n| fj-compose       | 8,581    | ± 0.61%                                       | 184         | [334 B](https://bundlephobia.com/result?p=fj-compose)       |\n| compose-funcs    | 356      | ± 1.58%                                       | 176         | [594 B](https://bundlephobia.com/result?p=compose-funcs)    |\n\nTo rerun this benchmark\n\n```sh\nnode benchmark\n```\n","funding_links":[],"categories":["JavaScript","Modules"],"sub_categories":["Function"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhipstersmoothie%2Fcompose-tiny","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhipstersmoothie%2Fcompose-tiny","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhipstersmoothie%2Fcompose-tiny/lists"}