├── .editorconfig ├── .gitignore ├── README.md ├── package.json └── snippets ├── bdd-describe.cson ├── bdd-ita.cson ├── bdd-itp.cson ├── bdd-its.cson ├── console-dir.cson ├── console-error.cson ├── console-info.cson ├── console-log.cson ├── console-warn.cson ├── dom-addEvent.cson ├── dom-attrGet.cson ├── dom-attrRemove.cson ├── dom-attrSet.cson ├── dom-childAppend.cson ├── dom-childRemove.cson ├── dom-classAdd.cson ├── dom-classRemove.cson ├── dom-classToggle.cson ├── dom-createDocumentFragment.cson ├── dom-createElement.cson ├── dom-getByClass.cson ├── dom-getById.cson ├── dom-getByTag.cson ├── dom-innerHTML.cson ├── dom-querySelector.cson ├── dom-querySelectorAll.cson ├── dom-textContent.cson ├── for-each.cson ├── for-in.cson ├── function-anonymous.cson ├── function-apply.cson ├── function-call.cson ├── function-iife.cson ├── function-objectProperty.cson ├── function-prototype.cson ├── function.cson ├── json-parse.cson ├── json-stringify.cson ├── misc-alert.cson ├── misc-confirm.cson ├── misc-debugger.cson ├── misc-prompt.cson ├── misc-useStrict.cson ├── node-assertDeepEqual.cson ├── node-assertEqual.cson ├── node-assertNotEqual.cson ├── node-moduleExports.cson ├── node-processExit.cson ├── node-require.cson ├── timer-setInterval.cson └── timer-setTimeout.cson /.editorconfig: -------------------------------------------------------------------------------- 1 | # This file is for unifying the coding style for different editors and IDEs 2 | # editorconfig.org 3 | 4 | root = true 5 | 6 | [*] 7 | end_of_line = lf 8 | insert_final_newline = false 9 | indent_style = spaces 10 | indent_size = 2 11 | end_of_line = lf 12 | charset = utf-8 13 | trim_trailing_whitespace = true -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | npm-debug.log 3 | node_modules 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # JavaScript Snippets for [Atom](http://atom.io) [![Build Status](https://secure.travis-ci.org/zenorocha/atom-javascript-snippets.svg?branch=master)](https://travis-ci.org/zenorocha/atom-javascript-snippets) 2 | 3 | ![Demo](https://cloud.githubusercontent.com/assets/398893/3528118/f07c2072-078b-11e4-93e9-ccb1339824e6.gif) 4 | 5 | ## Install 6 | 7 | Go to `Atom > Preferences...` then search for **JavaScript Snippets** in Packages tab. 8 | Restart atom. 9 | 10 | ## Development 11 | 12 | ```sh 13 | $ cd ~/.atom/packages 14 | $ git clone https://github.com/zenorocha/atom-javascript-snippets.git 15 | $ cd atom-javascript-snippets 16 | $ apm install 17 | $ apm link 18 | ``` 19 | 20 | ## Console 21 | 22 | ### [cd] console.dir 23 | 24 | ```javascript 25 | console.dir(${1:obj}); 26 | ``` 27 | 28 | ### [ce] console.error 29 | 30 | ```javascript 31 | console.error(${1:obj}); 32 | ``` 33 | 34 | ### [ci] console.info 35 | 36 | ```javascript 37 | console.info(${1:obj}); 38 | ``` 39 | 40 | ### [cl] console.log 41 | 42 | ```javascript 43 | console.log(${1:obj}); 44 | ``` 45 | 46 | ### [cw] console.warn 47 | 48 | ```javascript 49 | console.warn(${1:obj}); 50 | ``` 51 | 52 | ### [de] debugger 53 | 54 | ```javascript 55 | debugger; 56 | ``` 57 | 58 | ## DOM 59 | 60 | ### [ae] addEventListener 61 | 62 | ```javascript 63 | ${1:document}.addEventListener('${2:event}', function(e) { 64 | ${0:// body...} 65 | }); 66 | ``` 67 | 68 | ### [ac] appendChild 69 | 70 | ```javascript 71 | ${1:document}.appendChild(${2:elem}); 72 | ``` 73 | 74 | ### [rc] removeChild 75 | 76 | ```javascript 77 | ${1:document}.removeChild(${2:elem}); 78 | ``` 79 | 80 | ### [cel] createElement 81 | 82 | ```javascript 83 | ${1:document}.createElement(${2:elem}); 84 | ``` 85 | 86 | ### [cdf] createDocumentFragment 87 | 88 | ```javascript 89 | ${1:document}.createDocumentFragment(); 90 | ``` 91 | 92 | ### [ca] classList.add 93 | 94 | ```javascript 95 | ${1:document}.classList.add('${2:class}'); 96 | ``` 97 | 98 | ### [ct] classList.toggle 99 | 100 | ```javascript 101 | ${1:document}.classList.toggle('${2:class}'); 102 | ``` 103 | 104 | ### [cr] classList.remove 105 | 106 | ```javascript 107 | ${1:document}.classList.remove('${2:class}'); 108 | ``` 109 | 110 | ### [gi] getElementById 111 | 112 | ```javascript 113 | ${1:document}.getElementById('${2:id}'); 114 | ``` 115 | 116 | ### [gc] getElementsByClassName 117 | 118 | ```javascript 119 | ${1:document}.getElementsByClassName('${2:class}'); 120 | ``` 121 | 122 | ### [gt] getElementsByTagName 123 | 124 | ```javascript 125 | ${1:document}.getElementsByTagName('${2:tag}'); 126 | ``` 127 | 128 | ### [ga] getAttribute 129 | 130 | ```javascript 131 | ${1:document}.getAttribute('${2:attr}'); 132 | ``` 133 | 134 | ### [sa] setAttribute 135 | 136 | ```javascript 137 | ${1:document}.setAttribute('${2:attr}', ${3:value}); 138 | ``` 139 | 140 | ### [ra] removeAttribute 141 | 142 | ```javascript 143 | ${1:document}.removeAttribute('${2:attr}'); 144 | ``` 145 | 146 | ### [ih] innerHTML 147 | 148 | ```javascript 149 | ${1:document}.innerHTML = '${2:elem}'; 150 | ``` 151 | 152 | ### [tc] textContent 153 | 154 | ```javascript 155 | ${1:document}.textContent = '${2:content}'; 156 | ``` 157 | 158 | ### [qs] querySelector 159 | 160 | ```javascript 161 | ${1:document}.querySelector('${2:selector}'); 162 | ``` 163 | 164 | ### [qsa] querySelectorAll 165 | 166 | ```javascript 167 | ${1:document}.querySelectorAll('${2:selector}'); 168 | ``` 169 | 170 | ## Loop 171 | 172 | ### [fe] forEach 173 | 174 | ```javascript 175 | ${1:myArray}.forEach(function(${2:elem}) { 176 | ${0:// body...} 177 | }); 178 | ``` 179 | 180 | ### [fi] for in 181 | 182 | ```javascript 183 | for (${1:prop} in ${2:obj}) { 184 | if (${2:obj}.hasOwnProperty(${1:prop})) { 185 | ${0:// body...} 186 | } 187 | } 188 | ``` 189 | 190 | ## Function 191 | 192 | ### [fn] function 193 | 194 | ```javascript 195 | function ${1:methodName} (${2:arguments}) { 196 | ${0:// body...} 197 | } 198 | ``` 199 | 200 | ### [afn] anonymous function 201 | 202 | ```javascript 203 | function(${1:arguments}) { 204 | ${0:// body...} 205 | } 206 | ``` 207 | 208 | ### [pr] prototype 209 | 210 | ```javascript 211 | ${1:ClassName}.prototype.${2:methodName} = function(${3:arguments}) { 212 | ${0:// body...} 213 | } 214 | ``` 215 | 216 | ### [iife] immediately-invoked function expression 217 | 218 | ```javascript 219 | (function(${1:window}, ${2:document}) { 220 | ${0:// body...} 221 | })(${1:window}, ${2:document}); 222 | ``` 223 | 224 | ### [call] function call 225 | 226 | ```javascript 227 | ${1:methodName}.call(${2:context}, ${3:arguments}) 228 | ``` 229 | 230 | ### [apply] function apply 231 | 232 | ```javascript 233 | ${1:methodName}.apply(${2:context}, [${3:arguments}]) 234 | ``` 235 | 236 | ### [ofn] function as a property of an object 237 | 238 | ```javascript 239 | ${1:functionName}: function(${2:arguments}) { 240 | ${3:// body...} 241 | } 242 | ``` 243 | 244 | ## JSON 245 | 246 | ### [jp] JSON.parse 247 | 248 | ```javascript 249 | JSON.parse(${1:obj}); 250 | ``` 251 | 252 | ### [js] JSON.stringify 253 | 254 | ```javascript 255 | JSON.stringify(${1:obj}); 256 | ``` 257 | 258 | ## Timer 259 | 260 | ### [si] setInterval 261 | 262 | ```javascript 263 | setInterval(function() { 264 | ${0:// body...} 265 | }, ${1:delay}); 266 | ``` 267 | 268 | ### [st] setTimeout 269 | 270 | ```javascript 271 | setTimeout(function() { 272 | ${0:// body...} 273 | }, ${1:delay}); 274 | ``` 275 | 276 | ## NodeJS 277 | 278 | ### [ase] assert.equal 279 | 280 | ```javascript 281 | assert.equal(${1:actual}, ${2:expected}); 282 | ``` 283 | 284 | ### [asd] assert.deepEqual 285 | 286 | ```javascript 287 | assert.deepEqual(${1:actual}, ${2:expected}); 288 | ``` 289 | 290 | ### [asn] assert.notEqual 291 | 292 | ```javascript 293 | assert.notEqual(${1:actual}, ${2:expected}); 294 | ``` 295 | 296 | ### [me] module.exports 297 | 298 | ```javascript 299 | module.exports = ${1:name}; 300 | ``` 301 | 302 | ### [pe] process.exit 303 | 304 | ```javascript 305 | process.exit(${1:code}); 306 | ``` 307 | 308 | ### [re] require 309 | 310 | ```javascript 311 | require('${1:module}'); 312 | ``` 313 | ## BDD 314 | 315 | ### [desc] describe 316 | 317 | ```javascript 318 | describe('${1:description}', function() { 319 | ${0:// body...} 320 | }); 321 | ``` 322 | ### [ita] it asynchronous 323 | 324 | ```javascript 325 | it('${1:description}', function(done) { 326 | ${0:// body...} 327 | }); 328 | ``` 329 | 330 | ### [its] it synchronous 331 | 332 | ```javascript 333 | it('${1:description}', function() { 334 | ${0:// body...} 335 | }); 336 | ``` 337 | 338 | ### [itp] it pending 339 | 340 | ```javascript 341 | it('${1:description}'); 342 | ``` 343 | 344 | ## Misc 345 | 346 | ### [us] use strict 347 | 348 | ```javascript 349 | 'use strict'; 350 | ``` 351 | 352 | ### [al] alert 353 | 354 | ```javascript 355 | alert('${1:msg}'); 356 | ``` 357 | 358 | ### [co] confirm 359 | 360 | ```javascript 361 | confirm('${1:msg}'); 362 | ``` 363 | 364 | ### [pm] prompt 365 | 366 | ```javascript 367 | prompt('${1:msg}'); 368 | ``` 369 | 370 | ## Contributing 371 | 372 | 1. Fork it! 373 | 2. Create your feature branch: `git checkout -b my-new-feature` 374 | 3. Commit your changes: `git commit -m 'Add some feature'` 375 | 4. Push to the branch: `git push origin my-new-feature` 376 | 5. Submit a pull request :D 377 | 378 | ## History 379 | 380 | Check [Release](https://github.com/zenorocha/atom-javascript-snippets/releases) list. 381 | 382 | ## License 383 | 384 | [MIT License](http://zenorocha.mit-license.org/) © Zeno Rocha 385 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "javascript-snippets", 3 | "main": "./lib/javascript-snippets", 4 | "version": "1.2.1", 5 | "description": "JavaScript & NodeJS Snippets for Atom", 6 | "repository": "https://github.com/zenorocha/atom-javascript-snippets", 7 | "license": "MIT", 8 | "engines": { 9 | "atom": ">0.50.0" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /snippets/bdd-describe.cson: -------------------------------------------------------------------------------- 1 | ".source.js, .source.jsx, .source.ts, .source.js-semantic": 2 | "describe": 3 | "prefix": "desc" 4 | "body": """ 5 | describe('${1:description}', function() { 6 | \t${0:// body...} 7 | }); 8 | """ 9 | -------------------------------------------------------------------------------- /snippets/bdd-ita.cson: -------------------------------------------------------------------------------- 1 | ".source.js, .source.jsx, .source.ts, .source.js-semantic": 2 | "it asynchronous": 3 | "prefix": "ita" 4 | "body": """ 5 | it('${1:description}', function(done) { 6 | \t${0:// body...} 7 | }); 8 | """ 9 | -------------------------------------------------------------------------------- /snippets/bdd-itp.cson: -------------------------------------------------------------------------------- 1 | ".source.js, .source.jsx, .source.ts, .source.js-semantic": 2 | "it pending": 3 | "prefix": "itp" 4 | "body": """ 5 | it('${1:description}'); 6 | """ 7 | -------------------------------------------------------------------------------- /snippets/bdd-its.cson: -------------------------------------------------------------------------------- 1 | ".source.js, .source.jsx, .source.ts, .source.js-semantic": 2 | "it synchronous": 3 | "prefix": "its" 4 | "body": """ 5 | it('${1:description}', function() { 6 | \t${0:// body...} 7 | }); 8 | """ 9 | -------------------------------------------------------------------------------- /snippets/console-dir.cson: -------------------------------------------------------------------------------- 1 | ".source.js, .source.jsx, .source.ts, .source.js-semantic": 2 | "console.dir": 3 | "prefix": "cd" 4 | "body": "console.dir(${1:obj});" 5 | -------------------------------------------------------------------------------- /snippets/console-error.cson: -------------------------------------------------------------------------------- 1 | ".source.js, .source.jsx, .source.ts, .source.js-semantic": 2 | "console.error": 3 | "prefix": "ce" 4 | "body": "console.error(${1:obj});" 5 | -------------------------------------------------------------------------------- /snippets/console-info.cson: -------------------------------------------------------------------------------- 1 | ".source.js, .source.jsx, .source.ts, .source.js-semantic": 2 | "console.info": 3 | "prefix": "ci" 4 | "body": "console.info(${1:obj});" 5 | -------------------------------------------------------------------------------- /snippets/console-log.cson: -------------------------------------------------------------------------------- 1 | ".source.js, .source.jsx, .source.ts, .source.js-semantic": 2 | "console.log": 3 | "prefix": "cl" 4 | "body": "console.log(${1:obj});" 5 | -------------------------------------------------------------------------------- /snippets/console-warn.cson: -------------------------------------------------------------------------------- 1 | ".source.js, .source.jsx, .source.ts, .source.js-semantic": 2 | "console.warn": 3 | "prefix": "cw" 4 | "body": "console.warn(${1:obj});" 5 | -------------------------------------------------------------------------------- /snippets/dom-addEvent.cson: -------------------------------------------------------------------------------- 1 | ".source.js, .source.jsx, .source.ts, .source.js-semantic": 2 | "addEventListener": 3 | "prefix": "ae" 4 | "body": """ 5 | ${1:document}.addEventListener('${2:event}', function(e) { 6 | \t${0:// body...} 7 | }); 8 | """ 9 | -------------------------------------------------------------------------------- /snippets/dom-attrGet.cson: -------------------------------------------------------------------------------- 1 | ".source.js, .source.jsx, .source.ts, .source.js-semantic": 2 | "getAttribute": 3 | "prefix": "ga" 4 | "body": """ 5 | ${1:document}.getAttribute('${2:attr}'); 6 | """ 7 | -------------------------------------------------------------------------------- /snippets/dom-attrRemove.cson: -------------------------------------------------------------------------------- 1 | ".source.js, .source.jsx, .source.ts, .source.js-semantic": 2 | "removeAttribute": 3 | "prefix": "ra" 4 | "body": """ 5 | ${1:document}.removeAttribute('${2:attr}'); 6 | """ 7 | -------------------------------------------------------------------------------- /snippets/dom-attrSet.cson: -------------------------------------------------------------------------------- 1 | ".source.js, .source.jsx, .source.ts, .source.js-semantic": 2 | "setAttribute": 3 | "prefix": "sa" 4 | "body": """ 5 | ${1:document}.setAttribute('${2:attr}', ${3:value}); 6 | """ 7 | -------------------------------------------------------------------------------- /snippets/dom-childAppend.cson: -------------------------------------------------------------------------------- 1 | ".source.js, .source.jsx, .source.ts, .source.js-semantic": 2 | "appendChild": 3 | "prefix": "ac" 4 | "body": """ 5 | ${1:document}.appendChild(${2:elem}); 6 | """ 7 | -------------------------------------------------------------------------------- /snippets/dom-childRemove.cson: -------------------------------------------------------------------------------- 1 | ".source.js, .source.jsx, .source.ts, .source.js-semantic": 2 | "removeChild": 3 | "prefix": "rc" 4 | "body": """ 5 | ${1:document}.removeChild(${2:elem}); 6 | """ 7 | -------------------------------------------------------------------------------- /snippets/dom-classAdd.cson: -------------------------------------------------------------------------------- 1 | ".source.js, .source.jsx, .source.ts, .source.js-semantic": 2 | "classList.add": 3 | "prefix": "ca" 4 | "body": """ 5 | ${1:document}.classList.add('${2:class}'); 6 | """ 7 | -------------------------------------------------------------------------------- /snippets/dom-classRemove.cson: -------------------------------------------------------------------------------- 1 | ".source.js, .source.jsx, .source.ts, .source.js-semantic": 2 | "classList.remove": 3 | "prefix": "cr" 4 | "body": """ 5 | ${1:document}.classList.remove('${2:class}'); 6 | """ 7 | -------------------------------------------------------------------------------- /snippets/dom-classToggle.cson: -------------------------------------------------------------------------------- 1 | ".source.js, .source.jsx, .source.ts, .source.js-semantic": 2 | "classList.toggle": 3 | "prefix": "ct" 4 | "body": """ 5 | ${1:document}.classList.toggle('${2:class}'); 6 | """ 7 | -------------------------------------------------------------------------------- /snippets/dom-createDocumentFragment.cson: -------------------------------------------------------------------------------- 1 | ".source.js, .source.jsx, .source.ts, .source.js-semantic": 2 | "createDocumentFragment": 3 | "prefix": "cdf" 4 | "body": """ 5 | ${1:document}.createDocumentFragment(); 6 | """ 7 | -------------------------------------------------------------------------------- /snippets/dom-createElement.cson: -------------------------------------------------------------------------------- 1 | ".source.js, .source.jsx, .source.ts, .source.js-semantic": 2 | "createElement": 3 | "prefix": "cel" 4 | "body": """ 5 | ${1:document}.createElement(${2:elem}); 6 | """ 7 | -------------------------------------------------------------------------------- /snippets/dom-getByClass.cson: -------------------------------------------------------------------------------- 1 | ".source.js, .source.jsx, .source.ts, .source.js-semantic": 2 | "getElementsByClassName": 3 | "prefix": "gc" 4 | "body": """ 5 | ${1:document}.getElementsByClassName('${2:class}'); 6 | """ 7 | -------------------------------------------------------------------------------- /snippets/dom-getById.cson: -------------------------------------------------------------------------------- 1 | ".source.js, .source.jsx, .source.ts, .source.js-semantic": 2 | "getElementById": 3 | "prefix": "gi" 4 | "body": """ 5 | ${1:document}.getElementById('${2:id}'); 6 | """ 7 | -------------------------------------------------------------------------------- /snippets/dom-getByTag.cson: -------------------------------------------------------------------------------- 1 | ".source.js, .source.jsx, .source.ts, .source.js-semantic": 2 | "getElementsByTagName": 3 | "prefix": "gt" 4 | "body": """ 5 | ${1:document}.getElementsByTagName('${2:tag}'); 6 | """ 7 | -------------------------------------------------------------------------------- /snippets/dom-innerHTML.cson: -------------------------------------------------------------------------------- 1 | ".source.js, .source.jsx, .source.ts, .source.js-semantic": 2 | "innerHTML": 3 | "prefix": "ih" 4 | "body": """ 5 | ${1:document}.innerHTML = '${2:elem}'; 6 | """ 7 | -------------------------------------------------------------------------------- /snippets/dom-querySelector.cson: -------------------------------------------------------------------------------- 1 | ".source.js, .source.jsx, .source.ts, .source.js-semantic": 2 | "querySelector": 3 | "prefix": "qs" 4 | "body": """ 5 | ${1:document}.querySelector('${2:selector}'); 6 | """ 7 | -------------------------------------------------------------------------------- /snippets/dom-querySelectorAll.cson: -------------------------------------------------------------------------------- 1 | ".source.js, .source.jsx, .source.ts, .source.js-semantic": 2 | "querySelectorAll": 3 | "prefix": "qsa" 4 | "body": """ 5 | ${1:document}.querySelectorAll('${2:selector}'); 6 | """ 7 | -------------------------------------------------------------------------------- /snippets/dom-textContent.cson: -------------------------------------------------------------------------------- 1 | ".source.js, .source.jsx, .source.ts, .source.js-semantic": 2 | "textContent": 3 | "prefix": "tc" 4 | "body": """ 5 | ${1:document}.textContent = '${2:content}'; 6 | """ 7 | -------------------------------------------------------------------------------- /snippets/for-each.cson: -------------------------------------------------------------------------------- 1 | ".source.js, .source.jsx, .source.ts, .source.js-semantic": 2 | "forEach": 3 | "prefix": "fe" 4 | "body": """ 5 | ${1:myArray}.forEach(function(${2:elem}) { 6 | \t${0:// body...} 7 | }); 8 | """ 9 | -------------------------------------------------------------------------------- /snippets/for-in.cson: -------------------------------------------------------------------------------- 1 | ".source.js, .source.jsx, .source.ts, .source.js-semantic": 2 | "for in": 3 | "prefix": "fi" 4 | "body": """ 5 | for (${1:prop} in ${2:obj}) { 6 | \tif (${2:obj}.hasOwnProperty(${1:prop})) { 7 | \t\t${0:// body...} 8 | \t} 9 | } 10 | """ 11 | -------------------------------------------------------------------------------- /snippets/function-anonymous.cson: -------------------------------------------------------------------------------- 1 | ".source.js, .source.jsx, .source.ts, .source.js-semantic": 2 | "anonymous function": 3 | "prefix": "afn" 4 | "body": """ 5 | function(${1:arguments}) { 6 | \t${0:// body...} 7 | } 8 | """ 9 | -------------------------------------------------------------------------------- /snippets/function-apply.cson: -------------------------------------------------------------------------------- 1 | ".source.js, .source.jsx, .source.ts, .source.js-semantic": 2 | "function apply": 3 | "prefix": "apply" 4 | "body": """ 5 | ${1:methodName}.apply(${2:context}, [${3:arguments}]) 6 | """ 7 | -------------------------------------------------------------------------------- /snippets/function-call.cson: -------------------------------------------------------------------------------- 1 | ".source.js, .source.jsx, .source.ts, .source.js-semantic": 2 | "function call": 3 | "prefix": "call" 4 | "body": """ 5 | ${1:methodName}.call(${2:context}, ${3:arguments}) 6 | """ 7 | -------------------------------------------------------------------------------- /snippets/function-iife.cson: -------------------------------------------------------------------------------- 1 | ".source.js, .source.jsx, .source.ts, .source.js-semantic": 2 | "immediately-invoked function expression": 3 | "prefix": "iife" 4 | "body": """ 5 | (function(${1:window}, ${2:document}) { 6 | \t${0:// body...} 7 | })(${1:window}, ${2:document}); 8 | """ -------------------------------------------------------------------------------- /snippets/function-objectProperty.cson: -------------------------------------------------------------------------------- 1 | ".source.js, .source.jsx, .source.ts, .source.js-semantic": 2 | "function as a property of an object": 3 | "prefix": "ofn" 4 | "body": """ 5 | ${1:functionName}: function(${2:arguments}) { 6 | \t${3:// body...} 7 | } 8 | """ 9 | -------------------------------------------------------------------------------- /snippets/function-prototype.cson: -------------------------------------------------------------------------------- 1 | ".source.js, .source.jsx, .source.ts, .source.js-semantic": 2 | "prototype": 3 | "prefix": "pr" 4 | "body": """ 5 | ${1:ClassName}.prototype.${2:methodName} = function(${3:arguments}) { 6 | \t${0:// body...} 7 | } 8 | """ 9 | -------------------------------------------------------------------------------- /snippets/function.cson: -------------------------------------------------------------------------------- 1 | ".source.js, .source.jsx, .source.ts, .source.js-semantic": 2 | "function": 3 | "prefix": "fn" 4 | "body": """ 5 | function ${1:methodName} (${2:arguments}) { 6 | \t${0:// body...} 7 | } 8 | """ 9 | -------------------------------------------------------------------------------- /snippets/json-parse.cson: -------------------------------------------------------------------------------- 1 | ".source.js, .source.jsx, .source.ts, .source.js-semantic": 2 | "JSON.parse": 3 | "prefix": "jp" 4 | "body": "JSON.parse(${1:obj});" 5 | -------------------------------------------------------------------------------- /snippets/json-stringify.cson: -------------------------------------------------------------------------------- 1 | ".source.js, .source.jsx, .source.ts, .source.js-semantic": 2 | "JSON.stringify": 3 | "prefix": "js" 4 | "body": "JSON.stringify(${1:obj});" 5 | -------------------------------------------------------------------------------- /snippets/misc-alert.cson: -------------------------------------------------------------------------------- 1 | ".source.js, .source.jsx, .source.ts, .source.js-semantic": 2 | "alert": 3 | "prefix": "al" 4 | "body": """ 5 | alert('${1:msg}'); 6 | """ 7 | -------------------------------------------------------------------------------- /snippets/misc-confirm.cson: -------------------------------------------------------------------------------- 1 | ".source.js, .source.jsx, .source.ts, .source.js-semantic": 2 | "confirm": 3 | "prefix": "co" 4 | "body": """ 5 | confirm('${1:msg}'); 6 | """ 7 | -------------------------------------------------------------------------------- /snippets/misc-debugger.cson: -------------------------------------------------------------------------------- 1 | ".source.js, .source.jsx, .source.ts, .source.js-semantic": 2 | "debugger": 3 | "prefix": "de" 4 | "body": """ 5 | debugger; 6 | """ 7 | -------------------------------------------------------------------------------- /snippets/misc-prompt.cson: -------------------------------------------------------------------------------- 1 | ".source.js, .source.jsx, .source.ts, .source.js-semantic": 2 | "prompt": 3 | "prefix": "pm" 4 | "body": """ 5 | prompt('${1:msg}'); 6 | """ 7 | -------------------------------------------------------------------------------- /snippets/misc-useStrict.cson: -------------------------------------------------------------------------------- 1 | ".source.js, .source.jsx, .source.ts, .source.js-semantic": 2 | "use strict": 3 | "prefix": "us" 4 | "body": """ 5 | 'use strict'; 6 | """ 7 | -------------------------------------------------------------------------------- /snippets/node-assertDeepEqual.cson: -------------------------------------------------------------------------------- 1 | ".source.js, .source.jsx, .source.ts, .source.js-semantic": 2 | "assert.deepEqual": 3 | "prefix": "asd" 4 | "body": """ 5 | assert.deepEqual(${1:actual}, ${2:expected}); 6 | """ 7 | -------------------------------------------------------------------------------- /snippets/node-assertEqual.cson: -------------------------------------------------------------------------------- 1 | ".source.js, .source.jsx, .source.ts, .source.js-semantic": 2 | "assert.equal": 3 | "prefix": "ase" 4 | "body": """ 5 | assert.equal(${1:actual}, ${2:expected}); 6 | """ 7 | -------------------------------------------------------------------------------- /snippets/node-assertNotEqual.cson: -------------------------------------------------------------------------------- 1 | ".source.js, .source.jsx, .source.ts, .source.js-semantic": 2 | "assert.notEqual": 3 | "prefix": "asn" 4 | "body": """ 5 | assert.notEqual(${1:actual}, ${2:expected}); 6 | """ 7 | -------------------------------------------------------------------------------- /snippets/node-moduleExports.cson: -------------------------------------------------------------------------------- 1 | ".source.js, .source.jsx, .source.ts, .source.js-semantic": 2 | "module.exports": 3 | "prefix": "me" 4 | "body": """ 5 | module.exports = ${1:name}; 6 | """ 7 | -------------------------------------------------------------------------------- /snippets/node-processExit.cson: -------------------------------------------------------------------------------- 1 | ".source.js, .source.jsx, .source.ts, .source.js-semantic": 2 | "process.exit": 3 | "prefix": "pe" 4 | "body": """ 5 | process.exit(${1:code}); 6 | """ 7 | -------------------------------------------------------------------------------- /snippets/node-require.cson: -------------------------------------------------------------------------------- 1 | ".source.js, .source.jsx, .source.ts, .source.js-semantic": 2 | "require": 3 | "prefix": "re" 4 | "body": """ 5 | require('${1:module}'); 6 | """ 7 | -------------------------------------------------------------------------------- /snippets/timer-setInterval.cson: -------------------------------------------------------------------------------- 1 | ".source.js, .source.jsx, .source.ts, .source.js-semantic": 2 | "setInterval": 3 | "prefix": "si" 4 | "body": """ 5 | setInterval(function() { 6 | \t${0:// body...} 7 | }, ${1:delay}); 8 | """ 9 | -------------------------------------------------------------------------------- /snippets/timer-setTimeout.cson: -------------------------------------------------------------------------------- 1 | ".source.js, .source.jsx, .source.ts, .source.js-semantic": 2 | "setTimeout": 3 | "prefix": "st" 4 | "body": """ 5 | setTimeout(function() { 6 | \t${0:// body...} 7 | }, ${1:delay}); 8 | """ 9 | --------------------------------------------------------------------------------