Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 7bd3e30

Browse files
committed
refactor: Remove () for every function snippets to enhance capatibility.
This can make declare generator function, type generic type, return type easier. With side effect, merge anonymous function and named function snippets.
1 parent 3d8128c commit 7bd3e30

File tree

3 files changed

+20
-38
lines changed

3 files changed

+20
-38
lines changed

‎README.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,16 +64,14 @@ Install from VSCode Extension Marketplace [Hyper JavaScript Snippets](https://ma
6464
| `tcf` | try/catch/finally | `try {${1}} catch ${2} {${3}} finally {${0}}` |
6565

6666
### Functions
67-
| Prefix | Desc | Body |
68-
| -----: | ---------------------------------------------- | ---------------------------------- |
69-
| `f` | anonymous function | `function(${1}) {${0}}` |
70-
| `fn` | named function | `function ${1}(${2}) {${0}}` |
71-
| `fa` | async anonymous function | `async function (${1}) {${0}}` |
72-
| `fna` | async named function | `async function ${1}(${2}) {${0}}` |
73-
| `af` | arrow function (ES2015) | `(${1}) => ${0}` |
74-
| `afa` | async arrow function (ES2015) | `async (${1}) => ${0}` |
75-
| `iife` | immediately-invoked function expression (IIFE) | `(${2})(${1})${0}` |
76-
| `pd` | parameter destructuring with type (TypeScript) | `${0:param} : ${1:type}` |
67+
| Prefix | Desc | Body |
68+
| -----: | ---------------------------------------------- | ---------------------------- |
69+
| `f` | function | `function ${1} {${0}}` |
70+
| `fa` | async function | `async function ${1} {${0}}` |
71+
| `af` | arrow function (ES2015) | `${1} => ${0}` |
72+
| `afa` | async arrow function (ES2015) | `async ${1} => ${0}` |
73+
| `iife` | immediately-invoked function expression (IIFE) | `(${2})(${1})${0}` |
74+
| `pd` | parameter destructuring with type (TypeScript) | `${0:param} : ${1:type}` |
7775

7876
### Iterables
7977
| Prefix | Desc | Body |

‎snippets/javascript.json

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -86,29 +86,21 @@
8686
"body": "try {${1}} catch ${2} {${3}} finally {${0}}"
8787
},
8888

89-
"anonymous function": {
90-
"prefix": "f",
91-
"body": "function (${1}) {${0}}"
92-
},
9389
"function": {
94-
"prefix": "fn",
95-
"body": "function ${1}(${2}) {${0}}"
96-
},
97-
"async anonymous function": {
98-
"prefix": "fa",
99-
"body": "async function (${1}) {${0}}"
90+
"prefix": "f",
91+
"body": "function ${1} {${0}}"
10092
},
10193
"async function": {
102-
"prefix": "fna",
103-
"body": "async function ${1}(${2}) {${0}}"
94+
"prefix": "fa",
95+
"body": "async function ${1} {${0}}"
10496
},
10597
"arrow function (ES2015)": {
10698
"prefix": "af",
107-
"body": "(${1}) => ${0}"
99+
"body": "${1} => ${0}"
108100
},
109101
"async arrow function (ES2015)": {
110102
"prefix": "afa",
111-
"body": "async (${1}) => ${0}"
103+
"body": "async ${1} => ${0}"
112104
},
113105
"immediately-invoked function expression (IIFE)": {
114106
"prefix": "iife",

‎snippets/typescript.json

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -86,29 +86,21 @@
8686
"body": "try {${1}} catch ${2} {${3}} finally {${0}}"
8787
},
8888

89-
"anonymous function": {
90-
"prefix": "f",
91-
"body": "function(${1}) {${0}}"
92-
},
9389
"function": {
94-
"prefix": "fn",
95-
"body": "function ${1}(${2}) {${0}}"
96-
},
97-
"async anonymous function": {
98-
"prefix": "fa",
99-
"body": "async function (${1}) {${0}}"
90+
"prefix": "f",
91+
"body": "function ${1} {${0}}"
10092
},
10193
"async function": {
102-
"prefix": "fna",
103-
"body": "async function ${1}(${2}) {${0}}"
94+
"prefix": "fa",
95+
"body": "async function ${1} {${0}}"
10496
},
10597
"arrow function (ES2015)": {
10698
"prefix": "af",
107-
"body": "(${1}) => ${0}"
99+
"body": "${1} => ${0}"
108100
},
109101
"async arrow function (ES2015)": {
110102
"prefix": "afa",
111-
"body": "async (${1}) => ${0}"
103+
"body": "async ${1} => ${0}"
112104
},
113105
"immediately-invoked function expression (IIFE)": {
114106
"prefix": "iife",

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /