{"id":18799549,"url":"https://github.com/l2silver/khange","last_synced_at":"2026-01-02T20:30:15.220Z","repository":{"id":97819791,"uuid":"93859665","full_name":"l2silver/khange","owner":"l2silver","description":null,"archived":false,"fork":false,"pushed_at":"2018-05-22T14:12:24.000Z","size":29,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-30T15:48:59.483Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/l2silver.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-06-09T13:08:06.000Z","updated_at":"2018-05-22T14:12:25.000Z","dependencies_parsed_at":null,"dependency_job_id":"554da605-35bb-42b0-a6ac-7f6bf137bac3","html_url":"https://github.com/l2silver/khange","commit_stats":{"total_commits":7,"total_committers":3,"mean_commits":"2.3333333333333335","dds":0.4285714285714286,"last_synced_commit":"629deb47544e8d60b0d6cf027858f4c1ac660f6a"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/l2silver%2Fkhange","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/l2silver%2Fkhange/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/l2silver%2Fkhange/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/l2silver%2Fkhange/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/l2silver","download_url":"https://codeload.github.com/l2silver/khange/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239727856,"owners_count":19687259,"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-11-07T22:15:42.611Z","updated_at":"2026-01-02T20:30:15.171Z","avatar_url":"https://github.com/l2silver.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Khange\n\nHigher Order Component for on start and on props change logic.\n\n## Setup\n\n```\nnpm i -S khange\n```\n\n## Use\n\n```\nimport khange from 'khange'\n\nconst functionThatChecksWhetherIncomingPropsHaveChanged = (oldProps /* this.props or {} if onStart */, nextProps) =\u003e {\n    return oldProps.name === nextProps.name;\n}\n\nconst onChange = (props)=\u003eprops.loadNewData();\n\nkhange(functionThatChecksWhetherIncomingPropsHaveChanged, onChange)\n```\n\n### Kheck\n\nA simple utility function that takes any number of string arguments and checks whether the new prop is different that the old old\n\n```\nkheck('user.name') === (props, nextProps)=\u003e(props.user.name === nextProps.user.name)\nkheck('user.name', 'date') /* checks both properies, and if either one is not equal, returns false */\n```\n\n### Example\n\n```\nimport khange, {kheck} from 'khange'\n\nconst Simple = ()=\u003e\u003cdiv\u003eHello\u003c/div\u003e\n\nconst SimpleWithOnChange = khange(kheck('simple'), (props)=\u003eprops.loadMoreData())\n\n// loadMoreData on mount and when ever the simple prop changes then loadMoreData\n```\n\n### Advanced Example\n\n```\nimport khange, {kheck} from 'khange'\n\nconst Simple = ()=\u003e\u003cdiv\u003eHello\u003c/div\u003e\n\nconst SimpleWithOnChange = khange([kheck('simple'), (props)=\u003eprops.loadMoreData(), kheck('advanced'), (props)=\u003eprops.loadMoreAdvancedData()])\n\n// run multiple checks for changes and different onChange functions when those equality functions fails\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fl2silver%2Fkhange","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fl2silver%2Fkhange","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fl2silver%2Fkhange/lists"}