-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathmisc.cson
53 lines (49 loc) · 1.08 KB
/
misc.cson
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
".source.js, .source.jsx, .source.ts":
"use strict":
prefix: "us"
body: "'use strict'"
"const self this":
prefix: "self"
body: "const self = this"
"yield":
prefix: "ye"
body: "yield ${0}"
"await":
prefix: "aw"
body: "await ${0}"
"process.exit":
prefix: "pe"
body: "process.exit(${1:code})${0}"
"throw new error":
prefix: "thn"
body: "throw new ${1:TypeError}('${2:message}')${3}"
"if not typeof then throw error":
prefix: "iferr"
body: """
if (typeof ${1:actual} !== ${2:expected}) {
throw new ${3:TypeError}('${4:message}')
}${5}
"""
"JSON.stringify()":
prefix: "js"
body: "JSON.stringify($0)"
"JSON.parse()":
prefix: "jp"
body: "JSON.parse($0)"
"arrayify":
prefix: "afi"
body: """
/* istanbul ignore next */
const arrayify = (val) => {
if (!val) return []
if (Array.isArray(val)) return val
return [val]
}
"""
"fixture (useful for assert.throws)":
prefix: "fixture"
body: """
function fixture () {
${1:fnName}
}${0}
"""