Skip to content

Commit 6802295

Browse files
authored
Merge pull request #5 from pranav-kural/main
Added Snippets for Async Arrow Functions
2 parents da7ef0b + 5922883 commit 6802295

File tree

3 files changed

+77
-1
lines changed

3 files changed

+77
-1
lines changed

.vscode/settings.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,16 @@
1111
"afpr",
1212
"afrd",
1313
"afrj",
14+
"aaf",
15+
"aafa",
16+
"aafad",
17+
"aafe",
18+
"aafea",
19+
"aafer",
20+
"aafera",
21+
"aafead",
22+
"aaafea",
23+
"aafii",
1424
"arfeq",
1525
"arfne",
1626
"arfoeq",
@@ -33,6 +43,7 @@
3343
"Eomm",
3444
"Equiman",
3545
"iiaf",
46+
"iiaaf",
3647
"patreon",
3748
"paypal",
3849
"volta",

README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ Below is a list of all available snippets and the triggers of each one. The **
103103

104104
| Trigger | Description | Result JS/TS |
105105
| -------: | -------------------------------------- | ---------------------------------------------------------------- |
106-
| `af→` | implicit return without arg(s | `() => █` |
106+
| `af→` | implicit return without arg(s) | `() => █` |
107107
| `afa→` | implicit return with arg(s) | `(arg) => █` |
108108
| `afad→` | implicit return with arg destructuring | `({prop, prop}) => █` |
109109
| `afo→` | implicit return object | `() => ({prop: value█})` |
@@ -117,6 +117,21 @@ Below is a list of all available snippets and the triggers of each one. The **
117117
| `afpa→` | explicit with parentheses and arg(s) | <code>(arg) => {<br/>&nbsp;&nbsp;(█)<br/> }</code> |
118118
| `iiaf→` | immediately invoque | `(() => █)()` |
119119

120+
#### Async Arrow Functions
121+
122+
| Trigger | Description | Result JS/TS |
123+
| -------: | -------------------------------------- | ---------------------------------------------------------------- |
124+
| `aaf→` | async implicit return without arg(s) | `async () => █` |
125+
| `aafa→` | async implicit return with arg(s) | `async (arg) => █` |
126+
| `aafad→` | async implicit with arg destructuring | `async ({ prop }) => █` |
127+
| `aafe→` | async explicit empty | <code>async () => {<br/>&nbsp;&nbsp;█<br/> }</code> |
128+
| `aafea→` | async explicit empty with arg(s) | <code>async (arg) => {<br/>&nbsp;&nbsp;█<br/> }</code> |
129+
| `aafer→` | async explicit return | <code>async () => {<br/>&nbsp;&nbsp;return █<br/> }</code> |
130+
|`aafera→` | async explicit return with arg(s) | <code>async (arg) => {<br/>&nbsp;&nbsp;return █<br/> }</code> |
131+
|`aafead→` | explicit return with arg destructuring | <code>async ({prop}) => {<br/>&nbsp;&nbsp;return █<br/> }</code> |
132+
|`aaafea→` | async explicit empty with args & await | <code>async (arg) => {<br/>&nbsp;&nbsp;const █ = await █<br/> }</code>|
133+
| `aafii→` | async immediately invoked | `(async () => █)()` |
134+
120135
### Promises
121136

122137
| Trigger | Description | Result JS/TS |

snippets/arrow.json

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,5 +63,55 @@
6363
"prefix": ["iiaf", "afii"],
6464
"body": "(() => $0)()",
6565
"description": "Arrow function Immediately Invoke"
66+
},
67+
"arrowAsyncFunction": {
68+
"prefix": "aaf",
69+
"body": "async () => $0",
70+
"description": "Arrow async function"
71+
},
72+
"arrowAsyncFunctionWithArguments": {
73+
"prefix": "aafa",
74+
"body": "async (${1:arg}) => $0",
75+
"description": "Arrow async function (implicit return) with arguments"
76+
},
77+
"arrowAsyncFunctionImplicitWithArgumentDestructuring": {
78+
"prefix": "aafad",
79+
"body": "async ({ ${1:prop} }) => $0",
80+
"description": "Arrow function (explicit return) with argument destructuring"
81+
},
82+
"arrowAsyncFunctionExplicitEmpty": {
83+
"prefix": "aafe",
84+
"body": ["async () => {", "\t$0", "}"],
85+
"description": "Arrow async function (explicit without return)"
86+
},
87+
"arrowAsyncFunctionExplicitEmptyWithArguments": {
88+
"prefix": "aafea",
89+
"body": ["async (${1:arg}) => {", "\t$0", "}"],
90+
"description": "Arrow async function (explicit without return) with arguments"
91+
},
92+
"arrowAsyncFunctionExplicitReturn": {
93+
"prefix": "aafer",
94+
"body": ["async () => {", "\treturn ${0}", "}"],
95+
"description": "Arrow async function (explicit with return)"
96+
},
97+
"arrowAsyncFunctionExplicitReturnWithArguments": {
98+
"prefix": "aafera",
99+
"body": ["async (${1:arg}) => {", "\treturn ${0}", "}"],
100+
"description": "Arrow async function (explicit with return) with arguments"
101+
},
102+
"arrowAsyncFunctionExplicitWithArgumentDestructuring": {
103+
"prefix": "aafead",
104+
"body": ["async ({ ${1:prop} }) => {", "\treturn ${0}", "}"],
105+
"description": "Arrow async function (explicit return) with argument destructuring"
106+
},
107+
"arrowAsyncAwaitFunctionExplicitWithArguments": {
108+
"prefix": "aaafea",
109+
"body": ["async (${1:arg}) => {", "\tconst ${2} = await ${0}", "}"],
110+
"description": "Arrow async-await function (explicit with return) with arguments"
111+
},
112+
"arrowAsyncFunctionImmediatelyInvoque": {
113+
"prefix": ["iiaaf", "aafii"],
114+
"body": "(async () => $0)()",
115+
"description": "Arrow Async function Immediately Invoke"
66116
}
67117
}

0 commit comments

Comments
 (0)