Skip to content

Commit 8e10e13

Browse files
committed
refactor: removed hasOwnProperty check in foi
1 parent c574c5d commit 8e10e13

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

README.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,16 @@ Related snippets shared a same namespace, like for every `for` loop snippets pre
5858
| `case` | switch's case | `case $1 : $0` |
5959

6060
### Statement
61-
| Prefix | Desc | Body |
62-
| -----: | -------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
63-
| `fo` | for loop | `for ($1 ; $2 ; $3) $0` |
64-
| `foi` | for in loop | <code>for (const $1 in $2) {<br>&nbsp;&nbsp;if ($2.hasOwnProperty($1)) {<br>&nbsp;&nbsp;&nbsp;&nbsp;$0<br>&nbsp;&nbsp;}<br>}</code> |
65-
| `fof` | for of loop (ES2015) | `for (const $1 of $2) $0` |
66-
| `foa` | for await of loop (ES2018) | `for await (const $1 of $2) $0` |
67-
| `wh` | while loop | `while ($1) $0` |
68-
| `tc` | try/catch | `try {$1} catch $2 {$0}` |
69-
| `tf` | try/finally | `try {$1} finally {$0}` |
70-
| `tcf` | try/catch/finally | `try {$1} catch $2 {$3} finally {$0}` |
61+
| Prefix | Desc | Body |
62+
| -----: | -------------------------- | ------------------------------------- |
63+
| `fo` | for loop | `for ($1 ; $2 ; $3) $0` |
64+
| `foi` | for in loop | `for (const $1 in $2) $0` |
65+
| `fof` | for of loop (ES2015) | `for (const $1 of $2) $0` |
66+
| `foa` | for await of loop (ES2018) | `for await (const $1 of $2) $0` |
67+
| `wh` | while loop | `while ($1) $0` |
68+
| `tc` | try/catch | `try {$1} catch $2 {$0}` |
69+
| `tf` | try/finally | `try {$1} finally {$0}` |
70+
| `tcf` | try/catch/finally | `try {$1} catch $2 {$3} finally {$0}` |
7171

7272
### Functions
7373
| Prefix | Desc | Body |

src/snippet/javascript.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export const javascript = createXSnippets({
6161
},
6262
foi: {
6363
name: 'for in loop',
64-
body: 'for (const $1 in $2) {\n\tif ($2.hasOwnProperty($1)) {\n\t\t$0\n\t}\n}',
64+
body: 'for (const $1 in $2) $0',
6565
},
6666
fof: {
6767
name: 'for of loop (ES2015)',

0 commit comments

Comments
 (0)