List of JavaScript live templates
This table summarizes the live templates that you can use with your JavaScript code.
Abbreviation | Description | Template text |
---|---|---|
arf
| Surround with Arrow Function |
const $NAME$ = () => {
$SELECTION$
}
|
assert
| console.assert() |
console.assert($END$)
|
defn
| Inserts define() expression |
define(["$MODULE_REF$"], function($MODULE_VAR$) {
$END$
});
|
error
| console.error() |
console.error($END$)
|
exportall
| Export statement - export * from 'a' |
export * from "$MODULE$";
$END$
|
exportfrom
| Export statement - export {b} from 'a' |
export {$ITEM$$END$} from "$MODULE$";
|
exportitems
| Export statement - export {b} |
export {$ITEM$$END$};
|
flow
| Inserts @flow annotation |
// @flow
|
fori
| Create iteration loop |
for($VARKIND$ $INDEX$ = 0; $INDEX$ < $LIMIT$; $INDEX$++) {
$END$
}
|
forin
| Iterate (for..in) |
for ($VARKIND$ $VAR$ in $ARRAY$) {
$END$
}
|
forof
| Iterate (for..of) |
for ($VARKIND$ $VAR$ of $ARRAY$) {
$END$
}
|
importdefault
| Import statement - import b from 'a' |
import $ITEM$ from "$MODULE$";
$END$
|
importitems
| Import statement - import {b} from 'a' |
import {$ITEM$$END$} from "$MODULE$";
|
importns
| Import statement - import * as b from 'a' |
import * as $ITEM$ from "$MODULE$";
$END$
|
info
| console.info() |
console.info($END$)
|
itar
| Iterate elements of array |
for ($VARKIND$ $INDEX$ = 0; $INDEX$ < $ARRAY$.length; $INDEX$++) {
$VARKIND2$ $VAR$ = $ARRAY$[$INDEX$];
$END$
}
|
iter
| Iterate (for..of) |
for ($VARKIND$ $VAR$ of $ARRAY$) {
$END$
}
|
itera
| Iterate (for await..of) |
for await ($VARKIND$ $VAR$ of $ARRAY$) {
$END$
}
|
itin
| Iterate (for..in) |
for ($VARKIND$ $VAR$ in $ARRAY$) {
$END$
}
|
log
| console.log() |
console.log($END$)
|
moduleexports
| Export statement - module.exports |
module.exports = $END$
|
ref
| Inserts reference path comment |
///<reference path="$PATH$"/>
$END$
|
ritar
| Iterate elements of array in reverse order |
for ($VARKIND$ $INDEX$ = $ARRAY$.length - 1; $INDEX$ >= 0; $INDEX$--) {
$VARKIND2$ $VAR$ = $ARRAY$[$INDEX$];
$END$
}
|
trace
| console.trace() |
console.trace($END$)
|
us
| Inserts 'use strict' statement |
"use strict";
$END$
|
warn
| console.warn() |
console.warn($END$)
|