100 lines
1.7 KiB
Plaintext
100 lines
1.7 KiB
Plaintext
# From the TextMate bundle
|
|
# with some modification
|
|
|
|
snippet fun "Function" b
|
|
${1:name} = ${2:(${3:args}) }->
|
|
${0:# body...}
|
|
endsnippet
|
|
|
|
snippet bfun "Function (bound)"
|
|
${1:(${2:args}) }=>
|
|
${0:# body...}
|
|
endsnippet
|
|
|
|
snippet if "If"
|
|
if ${1:condition}
|
|
${0:# body...}
|
|
endsnippet
|
|
|
|
snippet ife "If .. Else"
|
|
if ${1:condition}
|
|
${2:# body...}
|
|
else
|
|
${3:# body...}
|
|
endsnippet
|
|
|
|
snippet elif "Else if" b
|
|
else if ${1:condition}
|
|
${0:# body...}
|
|
endsnippet
|
|
|
|
snippet ifte "Ternary if"
|
|
if ${1:condition} then ${2:value} else ${3:other}
|
|
endsnippet
|
|
|
|
snippet unl "Unless"
|
|
${1:action} unless ${2:condition}
|
|
endsnippet
|
|
|
|
snippet fora "Array Comprehension"
|
|
for ${1:name} in ${2:array}
|
|
${0:# body...}
|
|
endsnippet
|
|
|
|
snippet foro "Object Comprehension"
|
|
for ${1:key}, ${2:value} of ${3:Object}
|
|
${0:# body...}
|
|
endsnippet
|
|
|
|
snippet forr "Range Comprehension (inclusive)"
|
|
for ${1:name} in [${2:start}..${3:finish}]${4: by ${5:step}}
|
|
${0:# body...}
|
|
endsnippet
|
|
|
|
snippet forrex "Range Comprehension (exclusive)"
|
|
for ${1:name} in [${2:start}...${3:finish}]${4: by ${5:step}}
|
|
${0:# body...}
|
|
endsnippet
|
|
|
|
snippet swi "Switch"
|
|
switch ${1:object}
|
|
when ${2:value}
|
|
${3:# body...}
|
|
else
|
|
$0
|
|
endsnippet
|
|
|
|
snippet swit "Switch when .. then"
|
|
switch ${1:object}
|
|
when ${2:${3:condition} then ${4:value}}
|
|
else ${0:value}
|
|
endsnippet
|
|
|
|
snippet cla "Class" b
|
|
class ${1:ClassName}${2: extends ${3:Ancestor}}
|
|
|
|
${4:constructor: (${5:args}) ->
|
|
${6:# body...}}
|
|
$7
|
|
endsnippet
|
|
|
|
snippet try "Try .. Catch"
|
|
try
|
|
$1
|
|
catch ${2:error}
|
|
$3
|
|
endsnippet
|
|
|
|
snippet req "Require" b
|
|
${1/^'?(\w+)'?$/\L$1\E/} = require(${1:'${2:sys}'})
|
|
endsnippet
|
|
|
|
snippet # "Interpolated Code" i
|
|
#{$1}$0
|
|
endsnippet
|
|
|
|
snippet log "Log" b
|
|
console.log ${1:"${2:msg}"}
|
|
endsnippet
|
|
|