TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Show HN: Dynamically generate JavaScript class methods at runtime

1 pointsby ramadisabout 1 month ago
built a weird little library last friday night. it uses LLMs to auto-generate JavaScript class methods at runtime; no need to define the method ahead of time—just decorate your class, call whatever you want, and the model figures it out on the fly.<p>it uses `Proxy`s, and pipes the class definition and the call example to the LLM for it to generate a valid method.<p>here&#x27;s a very lean example:<p>``` class User { constructor(email) { this.email = email; } }<p>const EnhancedUser = asVibeClass(User);<p>const user = new EnhancedUser(&#x27;john@example.com&#x27;);<p>const domain = await user.getEmailDomain();<p>console.log(domain); &#x2F;&#x2F; example.com<p>```<p>of course it was not built for production use, but it was a fun exploration. would love to hear your thoughts!

no comments

no comments