Skip to main content

CurateClick

github.com favicon

js-trailing-closure-toy-compiler

一个简单的编译器项目,允许在JavaScript中使用Swift风格的尾闭包语法,将特定格式的代码转换为标准的JavaScript箭头函数语法。

Check out js-trailing-closure-toy-compiler on CurateClick

• Copy the embed code to showcase this product on your website

• Share on X to spread the word about this amazing tool

文章地址:动手写一个简单的编译器:在JavaScript中使用Swift的尾闭包语法最近业余时间在学习SwiftUI的过程中发现在SwiftUI中大量使用了尾闭包(Trailing Closure)的语法,觉得挺有趣的。作为一个经常使用JavaScript作为开发语言的前端来说,我忽然想可不可以自己写一个简单的编译器,在JavaScript中使用这种语法呢?于是就有了这个小项目 js-trailing-closure-toy-compiler ,通过这个编译器我们可以将下面的代码:javascripta(){}转换为:javascripta(() => {});或者将:javascripta(1, "hello"){ b, c in d() d{} d(1, "hello") d(1, "hello"){} d(1, "hello"){ e, f in g() }}转换为:javascripta(1, "hello", (b, c) => { d(); d(() => {}); d(1, "hello"); d(1, "hello", () => {}); d(1, "hello", (e, f) => { g() })})项目的在线演示地址:JavaScript Trailing Closure Toy Compiler

Latest Weekly Picks

freeadhd.com favicon
Weekly Pick

ADHD Test - a free, no-sign-up adult ADHD self-screening tool with instant results.

ADHD Test
pixmira.ai favicon
Weekly Pick

Free AI photo editor and image generator for fast visual creation.

PixMira AI
pslratings.com favicon
Weekly Pick

Free PSL Rating gives an instant AI PSL score with tier and four category breakdowns, no signup.

Free PSL Rating
gothic1remake.com favicon
Weekly Pick

Gothic 1 Remake Guide — Release, Walkthroughs & Quests

gothic 1 remake

Predict video virality before you publish.

Virality Predictor

Powerful Motion Control AI Video Generator

Motion Control AI

PlusGO 是面向中国大陆用户的 ChatGPT Plus 代充值服务平台。使用官方 CDKey,支持支付宝和微信扫码支付,平均 2 分钟完成 Plus 开通,自 2025 年起已为超过 10,000 名用户完成充值。

www.toolcenter.ai favicon
Weekly Pick

Discover the Best AI & Productivity Tools — 1,500+ tools with honest reviews.

ToolCenter