{"id":18910043,"url":"https://github.com/cheton/chained-function","last_synced_at":"2025-07-23T06:03:41.926Z","repository":{"id":57196684,"uuid":"82156723","full_name":"cheton/chained-function","owner":"cheton","description":"Chained function calls","archived":false,"fork":false,"pushed_at":"2019-08-27T11:52:04.000Z","size":5,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-03T18:35:10.018Z","etag":null,"topics":["chained","function"],"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/cheton.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":null,"patreon":null,"open_collective":"cheton","ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2017-02-16T08:19:12.000Z","updated_at":"2024-03-19T01:41:39.000Z","dependencies_parsed_at":"2022-09-01T00:26:27.535Z","dependency_job_id":null,"html_url":"https://github.com/cheton/chained-function","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/cheton/chained-function","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheton%2Fchained-function","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheton%2Fchained-function/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheton%2Fchained-function/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheton%2Fchained-function/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cheton","download_url":"https://codeload.github.com/cheton/chained-function/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheton%2Fchained-function/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265019405,"owners_count":23698878,"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":["chained","function"],"created_at":"2024-11-08T09:39:09.457Z","updated_at":"2025-07-23T06:03:41.907Z","avatar_url":"https://github.com/cheton.png","language":"JavaScript","readme":"# chained-function [![build status](https://travis-ci.org/cheton/chained-function.svg?branch=master)](https://travis-ci.org/cheton/chained-function) [![Coverage Status](https://coveralls.io/repos/github/cheton/chained-function/badge.svg?branch=master)](https://coveralls.io/github/cheton/chained-function?branch=master)\n\n[![NPM](https://nodei.co/npm/chained-function.png?downloads=true\u0026stars=true)](https://www.npmjs.com/package/chained-function)\n\n## Installation\n\n```bash\nnpm install --save chained-function\n```\n\n## Usage\n\n```js\nlet sum = 0;\nconst func = chainedFunction(\n    function(val) {\n        sum += val;\n        console.log(sum); // 2\n    },\n    function(val) {\n        sum += val;\n        console.log(sum); // 4\n    },\n    function(val) {\n        sum += val;\n        console.log(sum); // 6\n    }\n);\n\nfunc(2);\n```\n\n### React\n\n```js\nimport PropTypes from 'prop-types';\nimport React, { Component } from 'react';\nimport chainedFunction from 'chained-function';\n\nclass extends Component {\n    static propTypes = {\n        onClick: PropTypes.func\n    };\n    static contextTypes = {\n        $parent: PropTypes.shape({\n            onClick: PropTypes.func\n        })\n    };\n\n    actions = {\n        handleClick: (event) =\u003e {\n        }\n    }\n\n    render() {\n        const { onClick, ...props } = this.props;\n        const parent = this.context.$parent;\n\n        \u003ca\n            {...props}\n            onClick={chainedFunction(\n                this.actions.handleClick,\n                onClick,\n                parent \u0026\u0026 parent.onClick\n            )}\n        /\u003e\n    }\n}\n```\n\n## License\n\nMIT\n","funding_links":["https://opencollective.com/cheton"],"categories":["Utilities"],"sub_categories":["React Components"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcheton%2Fchained-function","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcheton%2Fchained-function","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcheton%2Fchained-function/lists"}