{"id":18779959,"url":"https://github.com/lhajman/javascript-es6-snippets","last_synced_at":"2025-12-18T14:30:32.650Z","repository":{"id":110030951,"uuid":"418248349","full_name":"tal7aouy/javascript-es6-snippets","owner":"tal7aouy","description":"Contains the code snippets for JavaScript (ES6) development in VS Code editor","archived":false,"fork":false,"pushed_at":"2022-01-02T19:20:02.000Z","size":29,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-29T10:41:59.451Z","etag":null,"topics":["es6","es6-javascript","snippets","visual-studio-code"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tal7aouy.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-10-17T20:30:54.000Z","updated_at":"2023-06-06T09:52:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"d1a39329-25f2-4b8a-8a44-41769f322ba6","html_url":"https://github.com/tal7aouy/javascript-es6-snippets","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tal7aouy%2Fjavascript-es6-snippets","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tal7aouy%2Fjavascript-es6-snippets/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tal7aouy%2Fjavascript-es6-snippets/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tal7aouy%2Fjavascript-es6-snippets/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tal7aouy","download_url":"https://codeload.github.com/tal7aouy/javascript-es6-snippets/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239694797,"owners_count":19681932,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["es6","es6-javascript","snippets","visual-studio-code"],"created_at":"2024-11-07T20:24:03.573Z","updated_at":"2025-12-18T14:30:27.387Z","avatar_url":"https://github.com/tal7aouy.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# JavaScript \u0026\u0026 Typescript\n\n## VS Code JavaScript (ES6+) snippets\n\n---\n\nThis extension contains code snippets for JavaScript in ES6 syntax for [Vs Code][code] editor (supports both JavaScript and TypeScript).\n\n## Installation\n\n1. Open the extensions sidebar on Visual Studio Code\n1. Search for Javascript(ES6)\n1. Click Install\n1. 🌟🌟🌟🌟🌟 Rate five-stars 😃\n\n## The languages supported (file extensions)\n\n- JavaScript (.js)\n- TypeScript (.ts)\n- JavaScript React (.jsx)\n- TypeScript React (.tsx)\n- Html (.html)\n- Vue (.vue)\n\n## Snippets\n\nSnippets are optimized to be short and easy to remember.\n\nBelow is a list of all available snippets and the triggers of each one. The ⇥ means the TAB key.\n\n### Import and export\n\n| Trigger | Content                                                                                                |\n| ------: | ------------------------------------------------------------------------------------------------------ |\n|  `imp⇥` | imports entire module `import fs from 'fs';`                                                           |\n|  `imn⇥` | imports entire module without module name `import 'bootstrap.min.css'`                                 |\n|  `imd⇥` | imports only a portion of the module using destructing `import {rename} from 'fs';`                    |\n|  `ime⇥` | imports everything as alias from the module `import * as alias from 'fs';`                             |\n|  `ima⇥` | imports only a portion of the module as alias `import { rename as localRename } from 'fs';`            |\n|  `rqr⇥` | require package `require('');`                                                                         |\n|  `req⇥` | require package to const `const packageName = require('packageName');`                                 |\n|  `mde⇥` | default module.exports `module.exports = {};`                                                          |\n|  `env⇥` | exports name variable `export const nameVariable = localVariable;`                                     |\n|  `enf⇥` | exports name function `export const log = (parameter) =\u003e { console.log(parameter);};`                  |\n|  `edf⇥` | exports default function `export default function fileName (parameter){ console.log(parameter);};`     |\n|  `ecl⇥` | exports default class `export default class Calculator { };`                                           |\n|  `ece⇥` | exports default class by extending a base one `export default class Calculator extends BaseClass { };` |\n\n### Object and Class helpers\n\n|  Trigger | Content                                                                                             |\n| -------: | --------------------------------------------------------------------------------------------------- |\n|   `con⇥` | adds default constructor in the class `constructor() {}`                                            |\n|   `met⇥` | creates a method inside a class `test() {}`                                                         |\n|   `pge⇥` | creates a getter property `get propertyName() {return value;}`                                      |\n|   `pse⇥` | creates a setter property `set propertyName(value) {}`                                              |\n|    `gs⇥` | creates a getter and setter property `set propertyName(value) {} get propertyName(){return value;}` |\n|    `ol⇥` | creates an object literal `set propertyName(value) {}`                                              |\n| `proto⇥` | creates a prototype method `obj.prototype.add = function() {}`                                      |\n|    `oa⇥` | creates an object assign `obj.assign(destObj, sourceObj)`                                           |\n\n### Various methods\n\n|  Trigger | Content                                                                               |\n| -------: | ------------------------------------------------------------------------------------- |\n|   `fre⇥` | forEach loop in ES6 syntax `array.forEach(currentItem =\u003e {})`                         |\n|   `fof⇥` | for ... of loop `for(const item of object) {}`                                        |\n|   `fin⇥` | for ... in loop `for(const item in object) {}`                                        |\n|  `anfn⇥` | creates an anonymous function `(params) =\u003e {}`                                        |\n|   `nfn⇥` | creates a named function `const add = (params) =\u003e {}`                                 |\n|    `gn⇥` | creates a generator `function* () {}`                                                 |\n|   `gfn⇥` | creates a named generator `function* generator() {}`                                  |\n|   `dob⇥` | destructing object syntax `const {rename} = fs`                                       |\n|   `dar⇥` | destructing array syntax `const [first, second] = [1,2]`                              |\n|   `sti⇥` | set interval helper method `setInterval(() =\u003e {});`                                   |\n|   `sto⇥` | set timeout helper method `setTimeout(() =\u003e {});`                                     |\n|  `prom⇥` | creates a new Promise `return new Promise((resolve, reject) =\u003e {});`                  |\n| `thenc⇥` | adds then and catch declaration to a promise `.then((res) =\u003e {}).catch((err) =\u003e {});` |\n\n### Console methods\n\n| Trigger | Content                                                            |\n| ------: | ------------------------------------------------------------------ |\n|  `cas⇥` | console alert method `console.assert(expression, object)`          |\n|   `cc⇥` | console clear `console.clear()`                                    |\n|  `cco⇥` | console count `console.count(label)`                               |\n|  `cdb⇥` | console debug `console.debug(object)`                              |\n|  `cdi⇥` | console dir `console.dir`                                          |\n|  `cer⇥` | console error `console.error(object)`                              |\n|  `cgr⇥` | console group `console.group(label)`                               |\n|  `cge⇥` | console groupEnd `console.groupEnd()`                              |\n|   `cl⇥` | console log `console.log(object)`                                  |\n|  `clo⇥` | console log object with name `console.log('object :\u003e\u003e ', object);` |\n|  `ctr⇥` | console trace `console.trace(object)`                              |\n|   `cw⇥` | console warn `console.warn`                                        |\n|   `ci⇥` | console info `console.info`                                        |\n|   `ct⇥` | console table `console.table`                                      |\n|  `cti⇥` | console time `console.time`                                        |\n|  `cte⇥` | console timeEnd `console.timeEnd`                                  |\n\n### Timers \u0026 strict mode\n\n| Trigger | Content                                |\n| ------: | -------------------------------------- |\n|  `sti⇥` | setInterval `setInterval(()=\u003e{},time)` |\n|  `sto⇥` | setTimeOut `setTimeOut(()=\u003e{},time)`   |\n\n### Types\n\n| Trigger | Content                                           |\n| ------: | ------------------------------------------------- |\n|  `tof⇥` | typeof object or instance `typeof x === 'number'` |\n|  `iof⇥` | instanceof `person instanceof Client`             |\n\n### Miscellaneous\n\n| Trigger | Content                         |\n| ------: | ------------------------------- |\n|   `us⇥` | use strict mode `'use strict';` |\n\n### Testing (Mocha, Jasmine, etc.)\n\n| Trigger | Content                                    |\n| ------: | ------------------------------------------ |\n| `desc⇥` | describe `describe('description',()=\u003e {})` |\n| `cont⇥` | context `context('description',()=\u003e {})`   |\n|   `it⇥` | it `it('description',()=\u003e {})`             |\n|  `its⇥` | it synchronous `it('description',()=\u003e {})` |\n|   `bf⇥` | before test suite `before(()=\u003e {})`        |\n|  `bfe⇥` | before each test `beforeEach(()=\u003e {})`     |\n|  `aft⇥` | after test suite `after(()=\u003e {})`          |\n|  `afe⇥` | after each test `afterEach(()=\u003e {})`       |\n\n### DOM\n\n|    Trigger | Content                                       |\n| ---------: | --------------------------------------------- |\n|   `docId⇥` | `document.getElementById(selector);`          |\n|    `docS⇥` | `\"document.querySelector(selector);`          |\n| `docSAll⇥` | `\"document.querySelectorAll(selector);`       |\n|    `docC⇥` | `\"document.getElementsByClassName(selector);` |\n|    `docC⇥` | `\"document.getElementsByClassName(selector);` |\n|    `docN⇥` | `\"document.getElementsByName(selector);`      |\n|    `docT⇥` | `\"document.getElementsByTagName(elem);`       |\n|  `docTxt⇥` | `\"document.createTextNode(text);`             |\n|   `addEv⇥` | `\"exmaple.addEventListener(event,()=\u003e{});`    |\n\n### Globals\n\n|  Trigger | Content       |\n| -------: | ------------- |\n|  `desc⇥` | describe      |\n| `desco⇥` | describe.only |\n| `descs⇥` | describe.skip |\n| `desce⇥` | describe.each |\n|    `ae⇥` | after each    |\n|    `aa⇥` | after all     |\n|    `be⇥` | before each   |\n|    `ba⇥` | before all    |\n\n### Tests\n\n|   Trigger | Content              |\n| --------: | -------------------- |\n|     `it⇥` | it                   |\n|    `ito⇥` | it.only              |\n|    `its⇥` | it.skip              |\n|    `itt⇥` | it.todo              |\n|    `ite⇥` | it.each              |\n|    `ita⇥` | it(..., async ...)   |\n|   `test⇥` | test                 |\n|  `testo⇥` | test.only            |\n|  `tests⇥` | test.skip            |\n|  `testt⇥` | test.todo            |\n|  `teste⇥` | test.each            |\n| `testet⇥` | test.each (table)    |\n|  `testa⇥` | test(..., async ...) |\n\n### Expect\n\n|   Trigger | Content                            |\n| --------: | ---------------------------------- |\n|    `exp⇥` | expect                             |\n|   `expr⇥` | expect.resolves                    |\n|  `exprj⇥` | expect.rejects                     |\n|  `expas⇥` | expect.assertions(count)           |\n|  `expha⇥` | expect.hasAssertions()             |\n|     `tb⇥` | toBe                               |\n|   `tbct⇥` | toBeCloseTo                        |\n|    `tbd⇥` | toBeDefined                        |\n|    `tbf⇥` | toBeFalsy                          |\n|   `tbgt⇥` | toBeGreaterThan                    |\n|  `tbgte⇥` | toBeGreaterThanOrEqual             |\n|    `tbi⇥` | toBeInstanceOf                     |\n|   `tblt⇥` | toBeLessThan                       |\n|  `tblte⇥` | toBeLessThanOrEqual                |\n|    `tbn⇥` | toBeNull                           |\n|    `tbt⇥` | toBeTruthy                         |\n|    `tbu⇥` | toBeUndefined                      |\n|     `tc⇥` | toContain                          |\n|    `tce⇥` | toContainEqual                     |\n|     `te⇥` | toEqual                            |\n|    `tse⇥` | toStrictEqual                      |\n|   `thbc⇥` | toHaveBeenCalled                   |\n|  `thbct⇥` | toHaveBeenCalledTimes              |\n|  `thbcw⇥` | toHaveBeenCalledWith               |\n| `thblcw⇥` | toHaveBeenLastCalledWith           |\n|    `thl⇥` | toHaveLength                       |\n|    `thp⇥` | toHaveProperty                     |\n|     `tm⇥` | toMatch                            |\n|    `tmo⇥` | toMatchObject                      |\n|    `tms⇥` | toMatchSnapshot                    |\n|   `tmis⇥` | toMatchInlineSnapshot              |\n|     `tt⇥` | toThrow                            |\n|    `tte⇥` | toThrowError                       |\n|  `ttems⇥` | toThrowErrorMatchingSnapshot       |\n| `ttemis⇥` | toThrowErrorMatchingInlineSnapshot |\n\n### Templates\n\n| Trigger | Content                 |\n| ------: | ----------------------- |\n|  `cut⇥` | test a class under test |\n|  `jfn⇥` | jest.fn                 |\n\n## Issues \u0026 Suggestions\n\nFor any issues or suggestions, please use [GitHub issues](https://github.com/tal7aouy/javascript-es6-snippets/issues).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flhajman%2Fjavascript-es6-snippets","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flhajman%2Fjavascript-es6-snippets","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flhajman%2Fjavascript-es6-snippets/lists"}