TypeScript · easy
Warehouse API promised a snapshot, but callers can push into the returned array and add "leak" to production stock. getStock is exposing the live shelf instead of a copy.
Return an independent list for each shelf. After a caller pushes "leak", a fresh getStock("desk") must still be ["pen","ink"] (length 2).
workspace/
└── src/
└── inventory.ts (returns the live stock array)With sharpen installed, this command opens exactly this challenge in your local arena:
sharpen 21
First time? The full install is right below.
npm install -g @juanwmedia/sharpen sharpen 21 npx @juanwmedia/sharpen 21 sharpen update