-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjavascript.snippets
132 lines (108 loc) · 1.86 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
snippet clb "console log box"
console.log('-----------')
console.log(${VISUAL}${1})$0
console.log('-----------')
endsnippet
snippet cl "console log" b
console.log(${1}${VISUAL})$0
endsnippet
snippet if "if" w
if (${1}) {
${VISUAL}${2}
}$0
endsnippet
snippet iif "inline if"
if (${1}) ${2}
endsnippet
snippet var "var" i
var ${1} = ${2};$0
endsnippet
snippet for "for loop"
for (let ${1} = 0; $1 <= ${2}; $1++) {
${VISUAL}${3}
}$0
endsnippet
snippet desc "describe block"
describe('${1}', () => {
${VISUAL}${2}
})$0
endsnippet
snippet it "it block"
it('${1}', () => {
${VISUAL}${2}
})$0
endsnippet
snippet before "before block"
before(() => {
${VISUAL}${1}
})$0
endsnippet
snippet switch "switch case"
switch(${1}) {
default:
return ${2}
}
endsnippet
snippet case "case"
case ${1}:
${0:${VISUAL}}
break
endsnippet
snippet fun "function"
function $0
endsnippet
snippet af "arrow-function"
(${1}) => $0
endsnippet
snippet mf "make function"
const ${1} = (${2}) => {
${VISUAL}$0
}
endsnippet
snippet "<((\w+).*)>" "Generic Tag" r
<`!p snip.rv = match.group(1)`>
${VISUAL}${1}
</`!p snip.rv = match.group(2)`>
endsnippet
snippet let "let"
let ${1} = ${2};$0
endsnippet
snippet const "const"
const ${1} = $2;$0
endsnippet
snippet try "try"
try {
${0:${VISUAL}}
} catch (${1}) {
${2:/* handle error */}
}
endsnippet
snippet catch ""
catch {
${VISUAL}${2}
}$0
endsnippet
snippet while "(condition) { ... }"
while (${1}) {
${0:${VISUAL}}
}
endsnippet
snippet import "import"
import ${1} from "${2}"$0
endsnippet
snippet imp "import"
import ${1} from "${2}"$0
endsnippet
snippet test "test"
test('${1}', () => {
${VISUAL}${2}
})
endsnippet
snippet impt "import test"
import React from 'react'
import renderer from 'react-test-renderer'
import { MockedProvider } from '@apollo/react-testing'
endsnippet
snippet ireact "import test"
import React from 'react'
endsnippet