TypeScript · easy
Feature flags should be read-only to callers. Right now getFlags returns the stored object, so one test can turn on prod.beta and change production configuration by accident.
Return an independent flags object for each environment. After getFlags("prod").beta = true, a fresh getFlags("prod").beta must still be false.
workspace/
└── src/
└── flags.ts (returns the live object)With sharpen installed, this command opens exactly this challenge in your local arena:
sharpen 22
First time? The full install is right below.
npm install -g @juanwmedia/sharpen sharpen 22 npx @juanwmedia/sharpen 22 sharpen update