snippet :f
options head
  ${1:#:method_name}: function(${2:#:attribute}) {
    ${0:TARGET}
  }

snippet function
abbr    func
options word
  function ${1:#:function_name}(${2:#:argument}) {
    ${0:TARGET}
  }

snippet function2
abbr    func2
options head
  function ${1:function_name}(${2:argument}) {
    ${0:TARGET}
  }

snippet proto
options head
  ${1:#:class_name}.prototype.${2:#:method_name} = function(${3:#:first_argument}) {
    ${0:TARGET}
  };


snippet f
options word
  function(${1}) { ${0:TARGET} };

snippet if
options head
  if (${1:true}) {
    ${0:TARGET}
  }

snippet if-else
abbr ife
options head
  if (${1:#:condition}) {
    ${2:TARGET}
  } else {
    ${3}
  }

snippet for
options head
  for (var ${1:i} = 0; $1 < ${2:#:Things}.length; ++$1) {
    ${0:TARGET}
  }

snippet forin
options head
  for (var ${1:i} in ${2:#:Things}) {
    ${0:TARGET}
  }

snippet while
options head
  while (${1:true}) {
    ${0:TARGET}
  }

snippet switch
options head
  switch (${1:#:var}) {
    case ${2:#:val}:
      ${0:TARGET}
      break;
  }

snippet try
options head
  try {
    ${1:TARGET}
  } catch (${2:e}) {
    ${3}
  }

snippet try_finally
options head
  try {
    ${1:TARGET}
  } catch (${2:e}) {
    ${3}
  } finally {
    ${4}
  }


snippet key-value
abbr :,
options word
  ${1:#:value_name}: ${0:#:value},

#snippet key
#options word
#  ${1:#:key}: "${2:#:value}"}${3:, }

snippet setTimeout-function
options head
  setTimeout(function() { ${0} }, ${1:10});

snippet debugger
alias db
options head
  debugger;

snippet console-log
alias cl
options head
  console.log(${0:TARGET});

snippet console-trace
alias ct
options head
  console.trace();

snippet console-error
alias ce
options head
  console.error(${0:TARGET});

snippet console-warn
alias cw
options head
  console.warn(${0:TARGET});

snippet console-info
alias ci
options head
  console.info(${0:TARGET});

snippet iife
options head
  (function(${1}) {
    'use strict';
    ${0:TARGET}
  })(${2});

snippet js
options head
  JSON.stringify(${1:TARGET}, ${2:null}, ${3:2});

snippet jsc
options head
  console.log(JSON.stringify(${1:TARGET}, ${2:null}, ${3:2}));