how should I chain function call in coffeescript

前端 未结 2 1427
醉梦人生
醉梦人生 2021-02-13 01:35

This coffeecode

obj
  .func1()
  .func2()

will result in

obj.func1().func2();

this work find.

But w

2条回答
  •  孤街浪徒
    2021-02-13 02:10

    This issue has just been fixed here.

    So, for e.g.:

    obj
     .func1 "aaa"
     .func2 "bbb"
    

    will be compiled to

    obj.func1("aaa").func2("bbb");
    

    You may need to use the latest version at master branch for now, in npm:

    npm install -g http://github.com/jashkenas/coffee-script/tarball/master
    

提交回复
热议问题