Created
December 27, 2017 00:24
-
-
Save arthurbergmz/36140caa162db5327b0f3e01557b07b3 to your computer and use it in GitHub Desktop.
StandardJS Snippets for Visual Studio Code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"function 1": { | |
"prefix": "func", | |
"body": [ | |
"function ${1:name} ($2) {", | |
"\t$0", | |
"}" | |
], | |
"description": "ES6 import syntax" | |
}, | |
"function 2": { | |
"prefix": "function", | |
"body": [ | |
"function ${1:name} ($2) {", | |
"\t$0", | |
"}" | |
], | |
"description": "ES6 import syntax" | |
}, | |
"setter": { | |
"prefix": "set ", | |
"body": [ | |
"set $1 (${2:value}) {", | |
"\t${3:this.$2 = $2}$0", | |
"}" | |
], | |
"description": "setter syntax" | |
}, | |
"getter": { | |
"prefix": "get ", | |
"body": [ | |
"get $1 () {", | |
"\treturn ${0:null}", | |
"}" | |
], | |
"description": "getter syntax" | |
}, | |
"for": { | |
"prefix": "for", | |
"body": [ | |
"for (let i = 0, j = $1; i < j; ++i) {", | |
"\t$0", | |
"}" | |
], | |
"description": "for syntax" | |
}, | |
"for array": { | |
"prefix": "for arr", | |
"body": [ | |
"for (let i = 0, j = ${1:arr}.length; i < j; ++i) {", | |
"\t${2:const element = $1[i]}$0", | |
"}" | |
], | |
"description": "for syntax" | |
}, | |
"for...in": { | |
"prefix": "for in", | |
"body": [ | |
"for (const ${1:property} in ${2:obj}) {", | |
"\t$0", | |
"}" | |
], | |
"description": "for...in syntax" | |
}, | |
"while": { | |
"prefix": "while", | |
"body": [ | |
"while ($1) {", | |
"\t$0", | |
"}" | |
], | |
"description": "while syntax" | |
}, | |
"do while": { | |
"prefix": "do while", | |
"body": [ | |
"do {", | |
"\t$0", | |
"} while ($1)" | |
], | |
"description": "do while syntax" | |
}, | |
"(ES6) Arrow function": { | |
"prefix": "arrow", | |
"body": [ | |
"($1) => {", | |
"\t$0", | |
"}" | |
], | |
"description": "ES6 import syntax" | |
}, | |
"(ES6) import": { | |
"prefix": "imp", | |
"body": [ | |
"import $0" | |
], | |
"description": "ES6 import syntax" | |
}, | |
"(ES6) import from 1": { | |
"prefix": "import", | |
"body": [ | |
"import $2 from $1$0" | |
], | |
"description": "ES6 import syntax" | |
}, | |
"(ES6) import from 2": { | |
"prefix": "import from", | |
"body": [ | |
"import $2 from $1$0" | |
], | |
"description": "ES6 import syntax" | |
}, | |
"(ES6) import from 3": { | |
"prefix": "import {", | |
"body": [ | |
"import { $2 } from $1$0" | |
], | |
"description": "ES6 import syntax" | |
}, | |
"(ES6) import all": { | |
"prefix": "import all", | |
"body": [ | |
"import * as $1 from $2$0" | |
], | |
"description": "ES6 import syntax" | |
}, | |
"(ES6) export 1": { | |
"prefix": "exp", | |
"body": [ | |
"export $0" | |
], | |
"description": "ES6 export syntax" | |
}, | |
"(ES6) export 2": { | |
"prefix": "export", | |
"body": [ | |
"export ${0:default}" | |
], | |
"description": "ES6 export syntax" | |
}, | |
"(ES6) export from": { | |
"prefix": "export from", | |
"body": [ | |
"export $2 from $1$0" | |
], | |
"description": "ES6 export syntax" | |
}, | |
"(ES6) export default": { | |
"prefix": "export default", | |
"body": [ | |
"export default $1$0" | |
], | |
"description": "ES6 export syntax" | |
}, | |
"(ES6) export default function": { | |
"prefix": "export default function", | |
"body": [ | |
"export default function ($1) {", | |
"\t$0", | |
"}" | |
], | |
"description": "ES6 export syntax" | |
}, | |
"(ES6) export default class": { | |
"prefix": "export default class", | |
"body": [ | |
"export default class $1 {", | |
"\t$0", | |
"}" | |
], | |
"description": "ES6 export syntax" | |
}, | |
"(ES6) export default class w/ constructor": { | |
"prefix": "export default class constructor", | |
"body": [ | |
"export default class $1 {", | |
"\tconstructor ($2) {", | |
"\t\t$0", | |
"\t}", | |
"}" | |
], | |
"description": "ES6 export syntax" | |
}, | |
"(ES6) Promise 1": { | |
"prefix": "Promise", | |
"body": [ | |
"Promise((resolve, reject) => {", | |
"\t$0", | |
"})" | |
], | |
"description": "ES6 Promise syntax" | |
}, | |
"(ES6) Promise 2": { | |
"prefix": "Promise(", | |
"body": [ | |
"Promise((resolve, reject) => {", | |
"\t$0", | |
"}" | |
], | |
"description": "ES6 Promise syntax" | |
}, | |
"(ES6) Class": { | |
"prefix": "class", | |
"body": [ | |
"class $1 {", | |
"\t$0", | |
"}" | |
], | |
"description": "ES6 class syntax" | |
}, | |
"(ES6) Class w/ Constructor": { | |
"prefix": "class constructor", | |
"body": [ | |
"class $1 {", | |
"\tconstructor ($2) {", | |
"\t\t$0", | |
"\t}", | |
"}" | |
], | |
"description": "ES6 class syntax" | |
}, | |
"(ES6) Class Constructor": { | |
"prefix": "constructor", | |
"body": [ | |
"constructor ($1) {", | |
"\t$0", | |
"}" | |
], | |
"description": "ES6 constructor syntax" | |
}, | |
"(ES6) for...of": { | |
"prefix": "for of", | |
"body": [ | |
"for (const ${1:i} of ${2:arr}) {", | |
"\t$0", | |
"}" | |
], | |
"description": "ES6 for...of syntax" | |
}, | |
"(ES8) Async function 1": { | |
"prefix": "async", | |
"body": [ | |
"async function ${1:name} ($2) {", | |
"\t${4:await ${3:new Promise((resolve) => resolve())}}$0", | |
"}" | |
], | |
"description": "ES6 import syntax" | |
}, | |
"(ES8) Async function 2": { | |
"prefix": "afunc", | |
"body": [ | |
"async function ${1:name} ($2) {", | |
"\t${4:await ${3:new Promise((resolve) => resolve())}}$0", | |
"}" | |
], | |
"description": "ES6 import syntax" | |
}, | |
"(Template) Proxy handler": { | |
"prefix": "proxy handler", | |
"body": [ | |
"{", | |
"\tset (target, property, value, receiver) {", | |
"\t\treturn true", | |
"\t},", | |
"\tget (target, property, receiver) {", | |
"\t\treturn null", | |
"\t},", | |
"\thas (target, property) {", | |
"\t\treturn true", | |
"\t},", | |
"\tdeleteProperty (target, property) {", | |
"\t\treturn false", | |
"\t},", | |
"\tapply (target, thisArg, argumentsList) {", | |
"\t\treturn null", | |
"\t},", | |
"\tconstruct (target, argumentsList, newTarget) {", | |
"\t\treturn null", | |
"\t}", | |
"}$0" | |
], | |
"description": "Proxy handler template" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment