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

Installs

  • Total 117K
  • Win 70K
  • OS X 29K
  • Linux 18K
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 Mar 11 Mar 10 Mar 9 Mar 8 Mar 7 Mar 6 Mar 5 Mar 4 Mar 3 Mar 2 Mar 1 Feb 28 Feb 27 Feb 26 Feb 25 Feb 24 Feb 23 Feb 22 Feb 21 Feb 20 Feb 19 Feb 18 Feb 17 Feb 16 Feb 15 Feb 14 Feb 13 Feb 12 Feb 11 Feb 10 Feb 9
Windows 6 53 67 71 70 72 78 42 60 78 88 78 66 62 50 54 70 88 91 104 102 58 50 70 90 82 87 85 43 61 62 74 70 65 72 41 48 59 76 80 57 83 42 47 66 73
OS X 2 14 17 19 16 17 15 17 21 18 18 19 14 24 11 11 23 22 28 22 13 13 16 21 21 22 19 17 11 23 15 19 16 22 14 12 13 16 11 23 24 14 15 12 18 21
Linux 0 16 14 20 25 14 11 12 11 11 17 11 11 13 18 14 11 20 10 9 17 10 11 15 25 23 11 17 10 17 14 16 21 11 15 15 19 16 14 15 15 17 14 10 12 14

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