[afn] anonymous function
function (${1:arguments}) {
${0:// body...}
}
[cd] console.dir
console.dir(${1:obj})${0}
[ce] console.error
console.error(${1:error})${0}
[cl] console.log
console.log(${1:msg})${0}
[cli] console.log with util.inspect
console.log(require('util').inspect(${1:obj}, true, ${2:10}, true))${0}
[ct] console.trace
console.trace(${1:msg})${0}
[fn] function
function ${1:methodName} (${2:arguments}) {
${0:// body...}
}
[ii] Immediately-invoked function expression
(function () {
${0:// body...}
})();
[me] module.exports
[okfe] Objects.keys and forEach
Object.keys(${1:obj}).forEach(function (key) {
${0:// body...}
})
[pe] process.exit
[proto] prototype
${1:ClassName}.prototype.${2:methodName} = function (${3:arguments}) {
${0:// body...}
}
[req] require
require('${1:package}')${0}
[sto] setTimeout
setTimeout(function () {
${2:// body...}
}, ${1:millis})
[sti] setInterval
setInterval(function () {
${2:// body...}
}, ${1:millis})
[us] use strict
Behaviorial Driven Development
[desc] describe
describe('${1:description}', function () {
${0:// body...}
})
[ita] asychronous it
it('${1:description}', function (done) {
${0:// body...}
})
[its] synchronous it
it('${1:description}', function () {
${0:// body...}
})