https://github.com/jprichardson/sublime-js-snippets
Snippets for JavaScript / JS Programming in Sublime Text 2 & 3
https://github.com/jprichardson/sublime-js-snippets
Last synced: 4 months ago
JSON representation
Snippets for JavaScript / JS Programming in Sublime Text 2 & 3
- Host: GitHub
- URL: https://github.com/jprichardson/sublime-js-snippets
- Owner: jprichardson
- Created: 2012-11-14T17:35:51.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2017-07-14T19:15:43.000Z (almost 8 years ago)
- Last Synced: 2025-01-13T20:37:01.609Z (6 months ago)
- Homepage:
- Size: 24.4 KB
- Stars: 405
- Watchers: 25
- Forks: 52
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
Sublime Text Editor 2 / 3 - JavaScript Snippets
===========================================JavaScript / JS snippets for your Sublime Text 2 / 3 Fu.
Install
-------### Sublime Text 2 / 3 - Package Control
Install via package control: http://wbond.net/sublime_packages/community Search for **JavaScript Snippets** or typically the keywords **js** or **javascript** are suitable. You can install manually be cloning into your Sublime package directory.
Vanilla Snippets
--------### [afn] anonymous function
```js
function (${1:arguments}) {
${0:// body...}
}
```### [cd] console.dir
```js
console.dir(${1:obj})${0}
```### [ce] console.error
```js
console.error(${1:error})${0}
```### [ci] console.info
```js
console.info(${1:msg})${0}
```### [cl] console.log
```js
console.log(${1:msg})${0}
```### [cli] console.log with util.inspect
```js
console.log(require('util').inspect(${1:obj}, true, ${2:10}, true))${0}
```### [ct] console.trace
```js
console.trace(${1:msg})${0}
```### [cw] console.warn
```js
console.warn(${1:msg})${0}
```### [fn] function
```js
function ${1:methodName} (${2:arguments}) {
${0:// body...}
}
```### [ii] Immediately-invoked function expression
```js
(function () {
${0:// body...}
})();
```### [me] module.exports
```js
module.exports = ${1}
```### [okfe] Objects.keys and forEach
```js
Object.keys(${1:obj}).forEach(function (key) {
${0:// body...}
})
```### [pe] process.exit
```js
process.exit()
```### [proto] prototype
```js
${1:ClassName}.prototype.${2:methodName} = function (${3:arguments}) {
${0:// body...}
}
```### [req] require
```js
require('${1:package}')${0}
```### [sto] setTimeout
```js
setTimeout(function () {
${2:// body...}
}, ${1:millis})
```### [sti] setInterval
```js
setInterval(function () {
${2:// body...}
}, ${1:millis})
```### [us] use strict
```js
'use strict'
```Behaviorial Driven Development
------------------------------### [desc] describe
```js
describe('${1:description}', function () {
${0:// body...}
})
```### [ita] asychronous it
```js
it('${1:description}', function (done) {
${0:// body...}
})
```### [its] synchronous it
```js
it('${1:description}', function () {
${0:// body...}
})
```JavaScript Style
----------------[](https://github.com/feross/standard)
Uses [JavaScript Standard Code Style](https://github.com/feross/standard). Read the rules [here](https://github.com/feross/standard#rules).
License
-------Copyright 2012-2015, JP Richardson
MIT