Is it possible to define an infix function?

后端 未结 5 960
不思量自难忘°
不思量自难忘° 2021-02-08 09:21

Is it possible to define my own infix function/operator in CoffeeScript (or in pure JavaScript)? e.g. I want to call

a foo b

or



        
5条回答
  •  忘了有多久
    2021-02-08 10:06

    You can with sweet.js. See:

    1. http://sweetjs.org/doc/main/sweet.html#infix-macros
    2. http://sweetjs.org/doc/main/sweet.html#custom-operators

    Sweet.js extends Javascript with macros.

    It acts like a preprocessor.

提交回复
热议问题