Si

Simple dynamic templating in JS

Hacker News

Simple dynamic templating in JS

How do you guys deal with this scenario? const renderTemplate = (template, obj) => { const args = Object.keys(obj) const body = `return (\`${template}\`)` const renderFunc = new Function(...args.concat([body])) return renderFunc(...Object.values(obj)) } const dynamicallyLoadedTemplate = '${a} and ${b}' console.log( renderTemplate(dynamicallyLoadedTemplate, { 'a': '1', 'b': 2 }) ) Is this elegant enough?

Share card

Actual performance

3points
5comments
Did not reach leaderboard

Launch Intel predictions

Analyze your own launch →
BetaListMay not resonate with beta-testers · Missing: web3, chat, crypto
48%48% predicted probability of success on BetaList, based on ML models trained on real launch data.
best fitHighest predicted score across all platforms for this description.
AppSumoMay struggle as an AppSumo deal · Missing: plus, platform, intuitive
44%44% predicted probability of success on AppSumo, based on ML models trained on real launch data.
TrustMRRLess likely to generate early MRR · Missing: mobile apps, ios, personal
41%41% predicted probability of success on TrustMRR, 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
37%37% predicted probability of success on Hacker News, based on ML models trained on real launch data.
nativeThis product was originally launched on this platform.
Product HuntUnlikely to reach the leaderboard · Strong signals: new · Missing: mac, agents, macos
32%32% predicted probability of success on Product Hunt, 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.
Indie HackersIH features products with proven revenue · Missing: supports, reddit linkedin, podcasting
14%14% predicted probability of success on Indie Hackers, based on ML models trained on real launch data.

Correct prediction on native model

Similar products

Si
Simon, a simple approach to dynamic hosts with Redis + Lua + Nginx74%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Simon, a simple approach to dynamic hosts with Redis + Lua + Nginx

Hacker News1
Ho
Honeycomb-js – An implementation of a simple kaleidoscope46%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Honeycomb-js – An implementation of a simple kaleidoscope

Hacker News17
A
A simple, module-system-agnostic chainable comparators JS lib20%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

A simple, module-system-agnostic chainable comparators JS lib

Hacker News1
SimpleNextjs
SimpleNextjs15%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Next.js made simple

Indie Hackers
A
A simple tool for exploring AdSense with D3.js63%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

A simple tool for exploring AdSense with D3.js

Hacker News11
Mu
Multithread.js – In-browser multithreading made simple56%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Multithread.js – In-browser multithreading made simple

Hacker News2
A
A Simple Game Made with Three.js55%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

A Simple Game Made with Three.js

Hacker News1
Dy
Dynamic schemas for golang protobufs48%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Dynamic schemas for golang protobufs

Hacker News1
dd
ddgrey – dynamic and optionally distributed greylisting daemon75%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

ddgrey – dynamic and optionally distributed greylisting daemon

Hacker News2
Sc
Screencast on Meteor Dynamic Scoping58%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Screencast on Meteor Dynamic Scoping

Hacker News2