Wo

Worry-free object traversal in JavaScript

Hacker News

Worry-free object traversal in JavaScript

A co-worker today challenged me to come up with a way of traversing objects in JavaScript without worrying about whether any intermediary values were undefined. It had to be short, and it had to have an elegant syntax. This is what I came up with. I'm curious about how it could be done better, or whether people feel like it's an abomination, and a violation of the way people expect to work with objects in JavaScript.

Share card

Actual performance

2points
Did not reach leaderboard

Launch Intel predictions

Analyze your own launch →
Product HuntOn track for Day 1 leaderboard · Missing: mac, agents, macos
77%77% predicted probability of success on Product Hunt, based on ML models trained on real launch data.
best fitHighest predicted score across all platforms for this description.
TrustMRRLess likely to generate early MRR · Strong signals: way · Missing: mobile apps, ios, personal
46%46% predicted probability of success on TrustMRR, based on ML models trained on real launch data.
Indie HackersIH features products with proven revenue · Missing: supports, reddit linkedin, podcasting
44%44% predicted probability of success on Indie Hackers, based on ML models trained on real launch data.
Hacker NewsMay not resonate with HN audience · Strong signals: io · Missing: https docs, excited, just released
42%42% predicted probability of success on Hacker News, based on ML models trained on real launch data.
nativeThis product was originally launched on this platform.
AppSumoMay struggle as an AppSumo deal · Missing: plus, platform, intuitive
30%30% predicted probability of success on AppSumo, based on ML models trained on real launch data.
Acquire.comPre-revenue stage for this audience · Missing: arr, mrr, revenue
18%18% predicted probability of success on Acquire.com, based on ML models trained on real launch data.
BetaListMay not resonate with beta-testers · Missing: web3, chat, crypto
6%6% predicted probability of success on BetaList, based on ML models trained on real launch data.

Correct prediction on native model

Similar products

Se
See where a JavaScript object's properties were assigned35%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

See where a JavaScript object's properties were assigned

Hacker News2
I
I made a rational object for javascript45%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

I made a rational object for javascript

Hacker News13
Fu
Futuristic Object Traversal for JavaScript45%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Futuristic Object Traversal for JavaScript

Hacker News2
j2
j2c — JavaScript object to CSS compiler62%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

j2c — JavaScript object to CSS compiler

Hacker News5
Tr
Traverse JavaScript object graphs with jQuery42%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Traverse JavaScript object graphs with jQuery

Hacker News10
je
jemul8, an object-oriented JavaScript x86 Emulator72%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

jemul8, an object-oriented JavaScript x86 Emulator

Hacker News2
Ob
Object Playground - The definitive guide to object-oriented JavaScript55%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Object Playground - The definitive guide to object-oriented JavaScript

Hacker News5
Sl
Sliderm – A Dependency-Free JavaScript Slider41%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Sliderm – A Dependency-Free JavaScript Slider

Hacker News7
Aj
Ajaxial – Painless, JavaScript-Free Ajax58%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Ajaxial – Painless, JavaScript-Free Ajax

Hacker News1
It
Ity – A miniscule, depedency free JavaScript MVC55%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Ity – A miniscule, depedency free JavaScript MVC

Hacker News12