Your sort does nothing in Node and works in Bun
A comparator that returns true or false never returns a negative number, so V8 leaves the array exactly as it was. The same line sorts correctly in Bun, which is why it survives code review and ships.
25 posts
A comparator that returns true or false never returns a negative number, so V8 leaves the array exactly as it was. The same line sorts correctly in Bun, which is why it survives code review and ships.
toLocaleString groups French numbers with a narrow no-break space, not a normal one. The two strings print the same, fail ===, and the obvious fix turns 1234.5 into 1 without throwing.
JavaScript sorts number-like keys to the front of every object, so an ID-keyed list loses the order your API sent. UUID fixtures hide it. Here is the fix.
A logger that reports where each log came from kept naming one identical line for the app. Its stack-frame filter never skipped itself. Bug, repro, fix.
URLSearchParams sends missing filters as the literal word 'undefined'. The truthy filter that seems to fix it then quietly drops page=0.
jose 5 shipped two complete crypto implementations, one for Node and one for browsers. jose 6 ships one. I counted the files and ran the code in both.
Web Crypto signs a JWT with a 512-bit RSA key and calls it valid. RFC 7518 wants 2048 bits. Where that check lives, and how to test your own keys.
Reaching for .buffer to turn a Node Buffer into an ArrayBuffer hands you the whole 8KB allocation pool, not your 15 bytes. Here is the HMAC it silently breaks, the password it leaks, and why it works fine on a big payload and fails on a small one.
I tested every way to copy an object with a __proto__ key. Spread is safe, Object.assign is not, and only one of them reaches Object.prototype.
p-queue leaves dequeued items in place and moves a head pointer instead. I measured the difference: shift() took 3.5s where the pointer took 2.6ms.
A delay over 24.9 days overflows a 32-bit int, so setTimeout runs at once. What I measured in Node and Chrome, plus a long-timer fix.
fetch hands you a ReadableStream, so you can parse SSE and NDJSON yourself in about 100 lines. The part everyone gets wrong is cancellation: checking signal.aborted inside your read loop does not stop a stalled stream. I measured it — here is the proof and the fix.
My logger claimed it blocked newline injection. It only stripped carriage returns. Here is the real log injection bug and the fix I tested.
A request hook that merges headers with the spread operator keeps the token it just added and silently deletes every header the caller sent. Here is the test that proves it, in Node and in Chrome.
A window error listener ignores every failed image, script and stylesheet. One argument fixes it, then feeds your logger events with no error, no message.
new URL(path, baseURL) is not string joining. A leading slash wipes your base path, a missing trailing slash eats a segment, and the wrong path can send your auth token to someone else's server.
AbortSignal.timeout() starts counting when you create it, not when fetch runs. In a queue or retry loop it quietly kills requests still waiting their turn.
window.onerror is the answer everyone gives. It never fires for a broken image, and the next library that loads can delete yours. Here is what to use instead, on the client and on the server, tested in a real browser.
Error objects have non-enumerable fields, so a logger that just JSON.stringify's them prints an empty object. Here's why, and a serializer that captures message, stack, cause chains, and AggregateErrors properly.
A content queue, a Node generator script that calls the Claude API, and a scheduled GitHub Action that writes a post and commits it — the exact autopilot I use to keep this blog fed.
Use @anthropic-ai/sdk with a JSON schema so Claude returns validated, machine-readable data instead of free text — the exact pattern that powers this blog's auto-post generator.
Add left/right swipe navigation to a React slideshow using touchstart and touchend, a distance threshold to ignore accidental taps, and simple direction detection.
A mouse wheel fires dozens of events per flick. Learn how to use a ref-based lock plus a timeout so one scroll gesture advances exactly one panel in a React slideshow.
A small, dependency-free lightbox that opens images, diagrams, and code full-screen with zoom, drag-to-pan, and keyboard controls. Here's the real client-side logic, piece by piece.
Build a tiny remark plugin that counts the words in a Markdown post and exposes a '4 min read' estimate on Astro's frontmatter — grounded in real, working code.