chezmoi/private_dot_config/nvim/snippets/javascript.json

89 lines
1.8 KiB
JSON

{
"Console log": {
"prefix": "cl",
"body": ["console.log($1)"],
"description": "Console log"
},
"Function": {
"prefix": "fn",
"body": [
"function $1($2) {",
" $3",
"}"
],
"description": "Function"
},
"Arrow function": {
"prefix": "af",
"body": ["const $1 = ($2) => {", " $3", "}"],
"description": "Arrow function"
},
"Arrow function inline": {
"prefix": "afi",
"body": ["const $1 = ($2) => $3"],
"description": "Arrow function inline"
},
"Import": {
"prefix": "imp",
"body": ["import $1 from '$2'"],
"description": "Import statement"
},
"Import destructured": {
"prefix": "impd",
"body": ["import { $1 } from '$2'"],
"description": "Import destructured"
},
"Export": {
"prefix": "exp",
"body": ["export const $1 = $2"],
"description": "Export statement"
},
"Export default": {
"prefix": "expd",
"body": ["export default $1"],
"description": "Export default"
},
"Try catch": {
"prefix": "try",
"body": [
"try {",
" $1",
"} catch (error) {",
" $2",
"}"
],
"description": "Try catch block"
},
"For loop": {
"prefix": "for",
"body": [
"for (let $1 = 0; $1 < $2; $1++) {",
" $3",
"}"
],
"description": "For loop"
},
"For of loop": {
"prefix": "forof",
"body": [
"for (const $1 of $2) {",
" $3",
"}"
],
"description": "For of loop"
},
"Async function": {
"prefix": "async",
"body": [
"async function $1($2) {",
" $3",
"}"
],
"description": "Async function"
},
"Async arrow function": {
"prefix": "asyncaf",
"body": ["const $1 = async ($2) => {", " $3", "}"],
"description": "Async arrow function"
}
}