-
Notifications
You must be signed in to change notification settings - Fork 2
/
javascript.snippets
112 lines (89 loc) · 1.62 KB
/
javascript.snippets
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
snippet f "Basic function" !w
function${1}(${2}) {
${3}
}
endsnippet
snippet r "return" !w
return ${1}
endsnippet
snippet s "var self" !w
var self = this;
endsnippet
snippet p "Promise" !w
new Promise(function(resolve, reject){
${1}
});
endsnippet
snippet bp "break point" !w
debugger;
endsnippet
snippet f, "Basic function with comma" !w
function${3}(${1}) {
${2}
},
endsnippet
snippet f; "Basic function with semicolon" !w
function${3}(${1}) {
${2}
};
endsnippet
snippet c "Callback" !w
function(${1:err}) {
${2}
})
endsnippet
snippet c; "Callback with semicolon" !w
function(${1:err}) {
${2}
});
endsnippet
snippet iferr "if error" !b
if (err) {
${1}
}
endsnippet
snippet rerr "return if error" !b
if (err) return cb(err);
endsnippet
snippet l "console.log()" !b
console.log(${1});
endsnippet
snippet i "console.info()" !b
console.info(${1});
endsnippet
snippet w "console.warn()" !b
console.warn(${1});
endsnippet
snippet e "console.error()" !b
console.error(${1});
endsnippet
snippet q "var Q" !b
var Q = require("q");
endsnippet
snippet m "module.exports" !b
module.exports =
endsnippet
snippet i "Mocha it" !bw
it("${1}", function() {
${2}
});
endsnippet
snippet desc "Mocha describe" !b
describe("${1}", function() {
${2}
});
endsnippet
snippet mocha "Mocha globals" !b
/*global it, describe, before, beforeEach, after, afterEach */
endsnippet
snippet ifmain "if (require.main === module)" !b
if (require.main === module) {
${1}
}
endsnippet
snippet bs "Super (Backbone)" !b
${1:Backbone.Model}.prototype.apply.${2:constructor}(this, arguments);
endsnippet
snippet exit "process.exit(0);" !b
process.exit(${1:0});
endsnippet