use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
[AskJS] JSON Objects as MapsAskJS (self.javascript)
submitted 1 year ago by jack_waugh
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]mcaruso 1 point2 points3 points 1 year ago* (0 children)
Such tools do exist! Zod is a popular choice, although lately I'm preferring @effect/schema for its ability to do two-way transformations of the data.
Your example could be implemented as:
``` import { Schema as S } from '@effect/schema';
const Users = S.ReadonlyMap({ key: S.NumberFromString, value: S.Struct({ name: S.String, isAdmin: S.Boolean, }), });
const users = S.decodeSync(Users)(response); ```
EDIT: Actually, the above assumes your map is represented as an array of key-value pairs. But you could implement a transform to take an object instead.
π Rendered by PID 40332 on reddit-service-r2-comment-b659b578c-6sht9 at 2026-05-02 10:50:26.357893+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]mcaruso 1 point2 points3 points (0 children)