{"id":20533451,"url":"https://github.com/solirius/feature-toggle-decorator","last_synced_at":"2025-10-29T12:10:31.437Z","repository":{"id":44216185,"uuid":"209599107","full_name":"Solirius/feature-toggle-decorator","owner":"Solirius","description":"JavaScript feature toggle decorator","archived":false,"fork":false,"pushed_at":"2022-12-30T18:41:39.000Z","size":92,"stargazers_count":0,"open_issues_count":7,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-16T13:19:14.704Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Solirius.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":"2019-09-19T16:22:14.000Z","updated_at":"2019-09-19T16:34:12.000Z","dependencies_parsed_at":"2023-01-31T13:15:29.850Z","dependency_job_id":null,"html_url":"https://github.com/Solirius/feature-toggle-decorator","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Solirius%2Ffeature-toggle-decorator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Solirius%2Ffeature-toggle-decorator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Solirius%2Ffeature-toggle-decorator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Solirius%2Ffeature-toggle-decorator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Solirius","download_url":"https://codeload.github.com/Solirius/feature-toggle-decorator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242138885,"owners_count":20078006,"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-16T00:21:28.412Z","updated_at":"2025-10-29T12:10:26.400Z","avatar_url":"https://github.com/Solirius.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\nFeature Toggle Decorator\n=========================\n[![Travis](https://img.shields.io/travis/solirius/feature-toggle-decorator.svg?style=flat-square)](https://travis-ci.org/solirius/feature-toggle-decorator) ![npm](https://img.shields.io/npm/v/feature-toggle-decorator.svg?style=flat-square) ![David](https://img.shields.io/david/solirius/feature-toggle-decorator.svg?style=flat-square)\n\nA decorator that will only execute the wrapped function if it is given a truthy parameter, and optionally call a fallback method if the feature is not enabled. \n\n## Installation\n\n```shell script\nnpm install --save feature-toggle-decorator\n```\n\n## Usage\n\n```javascript \nimport { isEnabled } from \"feature-toggle-decorator\";\n\nconst features = {\n  FEATURE_1: true,\n  FEATURE_2: false,\n  FEATURE_3: false\n};\n\nclass Example {\n  @isEnabled(features.FEATURE_1)\n  public test1() {\n    // will be called\n  }\n\n  @isEnabled(features.FEATURE_2)\n  public test2() {\n    // will not be called\n  }\n\n  @isEnabled(features.FEATURE_3, \"fallbackMethod\")\n  public test3(...args) {\n    // will not be called\n  }\n\n  public fallbackMethod() {\n    // will be called instead of test3\n  }\n\n}\n```\n\nNote that any arguments sent to a disabled method with a fallback will be passed on to the fallback.\n\n## Limitations\n\n- The decorator parameters are evaluated at compile time so it is not possible to dynamically toggle features\n- Fallback methods must be specified by string name\n\n## Contributing\n\nIssues and PRs are very welcome. To get the project set up run:\n\n```\ngit clone git@github.com:solirius/feature-toggle-decorator\nnpm install --dev\nnpm test\n```\n\nIf you would like to send a pull request please write your contribution in TypeScript and if possible, add a test.\n\n## License\n\nThis software is licensed under [GNU GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsolirius%2Ffeature-toggle-decorator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsolirius%2Ffeature-toggle-decorator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsolirius%2Ffeature-toggle-decorator/lists"}