All challenges

TypeScript · easy

Config bleed

#22

Situation

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.

Objective

Return an independent flags object for each environment. After getFlags("prod").beta = true, a fresh getFlags("prod").beta must still be false.

The repo at start

workspace/
└── src/
    └── flags.ts   (returns the live object)

Checks you will turn green

  • exports getFlags
  • prod flags are both false
  • dev keeps its own flags
  • beta stays false after mutate

Concepts

objectsmutation

Play it in your terminal

With sharpen installed, this command opens exactly this challenge in your local arena:

sharpen 22

First time? The full install is right below.

How to play

  1. 1 Install Claude Code if you do not have it yet: claude.com/claude-code
  2. 2 Install sharpen from npm:
    npm install -g @juanwmedia/sharpen
  3. 3 Then launch it; the arena opens in your browser:
    sharpen 22
  4. or Or try it without installing anything:
    npx @juanwmedia/sharpen 22
  5. 4 And to update when a new version ships:
    sharpen update