ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Java​Script Snippets

by jprichardson ST2/ST3 Top 100

Snippets for JavaScript / JS Programming in Sublime Text 2 & 3

Labels snippets

Details

  • 2015.06.18.14.29.46
  • github.​com
  • github.​com
  • 2 years ago
  • 1 hour ago
  • 5 years ago

Installs

  • Total 122K
  • Win 74K
  • OS X 29K
  • Linux 19K
May 27 May 26 May 25 May 24 May 23 May 22 May 21 May 20 May 19 May 18 May 17 May 16 May 15 May 14 May 13 May 12 May 11 May 10 May 9 May 8 May 7 May 6 May 5 May 4 May 3 May 2 May 1 Apr 30 Apr 29 Apr 28 Apr 27 Apr 26 Apr 25 Apr 24 Apr 23 Apr 22 Apr 21 Apr 20 Apr 19 Apr 18 Apr 17 Apr 16 Apr 15 Apr 14 Apr 13 Apr 12
Windows 48 69 67 55 66 62 53 37 62 72 93 85 65 39 35 56 55 71 71 69 45 46 78 70 55 74 58 28 46 64 101 75 63 105 35 49 98 78 70 63 53 34 39 68 76 74
OS X 10 16 27 17 22 9 11 13 9 24 14 19 19 6 8 24 23 20 19 14 8 15 17 11 23 20 7 7 13 17 10 18 17 21 5 11 21 16 28 30 27 7 17 17 22 20
Linux 12 10 17 15 14 18 6 9 8 21 10 20 19 10 10 7 13 14 15 8 7 10 15 16 19 14 17 11 15 16 9 19 23 15 11 11 16 18 15 21 15 12 14 16 14 16

Readme

Source
raw.​githubusercontent.​com

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

function (${1:arguments}) {
    ${0:// body...}
}

[cd] console.dir

console.dir(${1:obj})${0}

[ce] console.error

console.error(${1:error})${0}

[cl] console.log

console.log(${1:msg})${0}

[cli] console.log with util.inspect

console.log(require('util').inspect(${1:obj}, true, ${2:10}, true))${0}

[ct] console.trace

console.trace(${1:msg})${0}

[fn] function

function ${1:methodName} (${2:arguments}) {
    ${0:// body...}
}

[ii] Immediately-invoked function expression

(function () {
    ${0:// body...}
})();

[me] module.exports

module.exports = ${1}

[okfe] Objects.keys and forEach

Object.keys(${1:obj}).forEach(function (key) {
    ${0:// body...}
})

[pe] process.exit

process.exit()

[proto] prototype

${1:ClassName}.prototype.${2:methodName} = function (${3:arguments}) {
    ${0:// body...}
}

[req] require

require('${1:package}')${0}

[sto] setTimeout

setTimeout(function () {
    ${2:// body...}
}, ${1:millis})

[sti] setInterval

setInterval(function () {
    ${2:// body...}
}, ${1:millis})

[us] use strict

'use strict'

Behaviorial Driven Development

[desc] describe

describe('${1:description}', function () {
    ${0:// body...}
})

[ita] asychronous it

it('${1:description}', function (done) {
    ${0:// body...}
})

[its] synchronous it

it('${1:description}', function () {
    ${0:// body...}
})

JavaScript Style

js-standard-style

Uses JavaScript Standard Code Style. Read the rules here.

License

Copyright 2012-2015, JP Richardson jprichardson@gmail.com

MIT