{"id":13850262,"url":"https://github.com/fabientownsend/confeature-flag","last_synced_at":"2025-07-08T17:31:17.101Z","repository":{"id":42274594,"uuid":"258001725","full_name":"fabientownsend/confeature-flag","owner":"fabientownsend","description":"A sweet feature flag for JavaScript \u0026 TypeScript.","archived":false,"fork":false,"pushed_at":"2023-01-06T04:48:38.000Z","size":309,"stargazers_count":5,"open_issues_count":19,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-23T02:11:57.932Z","etag":null,"topics":["feature-flag","feature-flags","feature-toggle","feature-toggles","javascr","typescript","typescript-library"],"latest_commit_sha":null,"homepage":"https://confeature-flag.now.sh","language":"TypeScript","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/fabientownsend.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}},"created_at":"2020-04-22T19:36:58.000Z","updated_at":"2021-06-29T08:46:16.000Z","dependencies_parsed_at":"2023-02-05T08:46:27.292Z","dependency_job_id":null,"html_url":"https://github.com/fabientownsend/confeature-flag","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/fabientownsend/confeature-flag","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabientownsend%2Fconfeature-flag","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabientownsend%2Fconfeature-flag/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabientownsend%2Fconfeature-flag/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabientownsend%2Fconfeature-flag/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fabientownsend","download_url":"https://codeload.github.com/fabientownsend/confeature-flag/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabientownsend%2Fconfeature-flag/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262018077,"owners_count":23245599,"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":["feature-flag","feature-flags","feature-toggle","feature-toggles","javascr","typescript","typescript-library"],"created_at":"2024-08-04T20:01:02.262Z","updated_at":"2025-07-08T17:31:16.646Z","avatar_url":"https://github.com/fabientownsend.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eConfeature Flag 🍯\u003c/h1\u003e\n\n\u003ch2 align=\"center\"\u003eA sweet feature flag for JavaScript \u0026 TypeScript.\u003c/h2\u003e\n\n**🚀 Easy to use**: Declare the lists of your feature and for which context they are released.\n\n**😻 Fast feedback from users**: By avoiding long-lived Git branches, you can get feedback faster from your users.\n\n**🚦 Flexibility of release**: Be empowered by continuously deploying your code and deciding when/where and for who your features are released.\n\n## Getting Started\n\n**1** - Install Confeature Flag using `yarn`:\n\n`yarn add confeature-flag`\n\nOr `npm`:\n\n`npm install confeature-flag`\n\n**2** - Import the dependency\n\n```javascript\nconst { newConfeatureFlag } = require(\"confeature-flag\");\n\nor\n\nimport { newConfeatureFlag } from \"confeature-flag\";\n```\n\n**3** - Create the configuration which lists the features and the contexts for which they are released. This will work with a json or JavaScript object.\n\n```javascript\nconst configuration = `{\n  \"my_super_feature\": {\n    \"release_for\": [\"dev\", \"qa\", \"betaTesterUser\"]\n  }\n}`;\n```\n\n**4** - Then create a feature flag that contains the configuration plus the initial context. This will return an object with functions generated based on the list of the features provided.\n\n```javascript\nconst context = \"dev\";\nconst confeatureFlag = newConfeatureFlag(configuration, context);\n```\n\n**5.a** - The feature `my_super_feature` will generate `isMySuperFeatureReleased()` function and will return its result based on the initial context.\n\n```javascript\nif (confeatureFlag.isMySuperFeatureReleased()) {\n  // path if the feature is released for the initial context\n}\n```\n\n**5.b** - A second function is also generated for each feature which allows you to set a different context on the fly. The feature `my_super_feature` will generated `isMySuperFeareReleasedFor(yourDifferentContext)` and will return its result based on this new context.\n\n```javascript\nif (confeatureFlag.isMySuperFeatureReleasedFor(\"betaTesterUser\")) {\n  // path if the feature is released for a new context\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffabientownsend%2Fconfeature-flag","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffabientownsend%2Fconfeature-flag","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffabientownsend%2Fconfeature-flag/lists"}