CoffeeScript让javascript变得有趣,而且代码清晰,易用扩展,我在CoffeeScript的原基础上加入2个新字符串相关的语法。一个是类似Ruby Symbol的字串,一个是超长字串
1. Ruby Symbol like
CoffeeScript:console.info :hello, :world
console.info('hello', 'world');
What will be translated to for those code?
1. info:hello
{info: hello}
2. {:hello, :world}
ERROR! use {hello, world} instead
2. 正则表达示运算符
if :hello =~ /^\w+$/ console.info :ok, \&
var __matches = null;
if (__matches = 'hello'.match(/^\w+$/))
console.info('ok', __matches[0]);
3. Links
My forked CoffeeScript GitHub Repo with those 2 featuresOriginal CoffeeScript GitHub Repo