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
  • 4 years ago

Installs

  • Total 120K
  • Win 72K
  • OS X 29K
  • Linux 19K
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 Apr 11 Apr 10 Apr 9 Apr 8 Apr 7 Apr 6 Apr 5 Apr 4 Apr 3 Apr 2 Apr 1 Mar 31 Mar 30 Mar 29 Mar 28 Mar 27 Mar 26 Mar 25 Mar 24 Mar 23 Mar 22 Mar 21 Mar 20 Mar 19 Mar 18 Mar 17 Mar 16 Mar 15 Mar 14 Mar 13 Mar 12
Windows 35 63 105 35 49 98 78 70 63 53 34 39 68 76 74 73 80 46 53 62 76 96 91 61 41 49 73 73 72 83 73 49 53 67 71 70 72 78 42 60 78 88 78 66 62 50
OS X 9 17 21 5 11 21 16 28 30 27 7 17 17 22 20 27 14 12 16 19 19 32 21 15 14 13 20 16 21 16 19 15 14 17 19 16 17 15 17 21 18 18 19 14 24 11
Linux 3 23 15 11 11 16 18 15 21 15 12 14 16 14 16 19 16 19 9 12 15 10 14 23 16 8 23 13 16 19 15 6 16 14 20 25 14 11 12 11 11 17 11 11 13 18

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