Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # paste it in your atom snippets.cson file;
- ".source.js, .source.ts, .source.tsx, .source.js-semantic":
- "describe":
- prefix: "desc"
- body: """
- describe('${1:description}', function () {
- \t${0}
- });
- """
- "context":
- prefix: "cont"
- body: """
- context('${1:description}', function () {
- \t${0}
- });
- """
- "it":
- prefix: "it"
- body: """
- it('${1:description}', function () {
- \t${0}
- });
- """
- "it synchronous":
- prefix: "its"
- body: """
- it('${1:description}', function () {
- \t${0}
- });
- """
- "it asynchronous":
- prefix: "ita"
- body: """
- it('${1:description}', function (done) {
- \t${0}
- \tdone();
- });
- """
- "mocha before":
- prefix: "bf"
- body: """
- before(function () {
- \t${0}
- });
- """
- "mocha beforeEach":
- prefix: "bfe"
- body: """
- beforeEach(function () {
- \t${0}
- });
- """
- "mocha after":
- prefix: "aft"
- body: """
- after(function () {
- \t${0}
- });
- """
- "mocha afterEach":
- prefix: "afe"
- body: """
- afterEach(function () {
- \t${0}
- });
- """
- "class":
- prefix: "c"
- body: """
- class ${1:name} {
- \tconstructor(${2:arguments}) {
- \t\t${0}
- \t}
- }
- """
- "class extends":
- prefix: "cex"
- body: """
- class ${1:name} extends ${2:base} {
- \tconstructor(${3:arguments}) {
- \t\tsuper(${3:arguments});
- \t\t${0}
- \t}
- }
- """
- "constructor":
- prefix: "ctor"
- body: """
- constructor(${1:arguments}) {
- \tsuper(${1:arguments});${0}
- }
- """
- "console.log":
- prefix: "cl"
- body: "console.log(${0})"
- "console.error":
- prefix: "ce"
- body: "console.error(${0})"
- "console.warn":
- prefix: "cw"
- body: "console.warn(${0})"
- "getElementById":
- "prefix": "gi"
- "body": "${1:document}.getElementById('${2:id}')"
- "getElementsByClassName":
- "prefix": "gc"
- "body": "${1:document}.getElementsByClassName('${2:class}')"
- "getElementsByTagName":
- "prefix": "gt"
- "body": "${1:document}.getElementsByTagName('${2:tag}')"
- "querySelector":
- "prefix": "qs"
- "body": "${1:document}.querySelector('${2:selector}')"
- "querySelectorAll":
- "prefix": "qsa"
- "body": "${1:document}.querySelectorAll('${2:selector}')"
- "if statement":
- prefix: "if"
- body: """
- if (${1:condition}) {
- \t${0}
- }
- """
- "else statement":
- prefix: "el"
- body: """
- else {
- \t${0}
- }
- """
- "if/else statement":
- prefix: "ife"
- body: """
- if (${1:condition}) {
- \t${0}
- } else {
- \t
- }
- """
- "else if statement":
- prefix: "ei"
- body: """
- else if (${1:condition}) {
- \t${0}
- }
- """
- "for loop":
- prefix: "fl"
- body: """
- for (let ${1:i} = 0, ${2:len} = ${3:iterable}.length; ${1:i} < ${2:len}; ${1:i}++) {
- \t${0}
- }
- """
- "for in loop":
- prefix: "fi"
- body: """
- for (let ${1:key} in ${2:source}) {
- \tif (${2:source}.hasOwnProperty(${1:key})) {
- \t\t${0}
- \t}
- }
- """
- "for of loop":
- prefix: "fo"
- body: """
- for (let ${1:key} of ${2:source}) {
- \t${0}
- }
- """
- "while loop":
- prefix: "wl"
- body: """
- while (${1:condition}) {
- \t${0}
- }
- """
- "try/catch":
- prefix: "tc"
- body: """
- try {
- \t${0}
- } catch (${1:err}) {
- \t
- }
- """
- "try/finally":
- prefix: "tf"
- body: """
- try {
- \t${0}
- } finally {
- \t
- }
- """
- "try/catch/finally":
- prefix: "tcf"
- body: """
- try {
- \t${0}
- } catch (${1:err}) {
- \t
- } finally {
- \t
- }
- """
- "switch case":
- prefix: "sw"
- body: """
- switch (${1:expr}) {
- \tcase ${2:value}:
- \t\treturn $0;
- \tdefault:
- \t\treturn;
- }
- """
- # "sequence":
- # prefix: "seq"
- # body: """
- # [...Array(${1:length}).keys()]${0}
- # """
- "forEach loop":
- prefix: "fe"
- body: """
- ${1:iterable}.forEach(${2:item} => {
- \t${0}
- });
- """
- "chain forEach":
- prefix: ".fe"
- body: ".forEach(${1:item} => {${0}})"
- "map":
- prefix: "map"
- body: """
- ${1:iterable}.map(${2:item} => {
- \t${0}
- });
- """
- "chain map":
- prefix: ".map"
- body: ".map(${1:item} => {${0}})"
- "reduce":
- prefix: "reduce"
- body: """
- ${1:iterable}.reduce((${2:previous}, ${3:current}) => {
- \t${0}
- }${4:, initial});
- """
- "chain reduce":
- prefix: ".reduce"
- body: ".reduce((${1:previous}, ${2:current}) => {${0}}${4:, initial})"
- "filter":
- prefix: "filter"
- body: """
- ${1:iterable}.filter(${2:item} => {
- \t${0}
- });
- """
- "chain filter":
- prefix: ".filter"
- body: ".filter(${1:item} => {${0}})"
- "find":
- prefix: "find"
- body: """
- ${1:iterable}.find(${2:item} => {
- \t${0}
- });
- """
- "chain find":
- prefix: ".find"
- body: ".find(${1:item} => {${0}})"
- "module export":
- prefix: "ex"
- body: "export ${1:member};"
- "module default export":
- prefix: "exd"
- body: "export default ${1:member};"
- "import module":
- prefix: "im"
- body: "import ${1:*} from '${2:module}';"
- "import module as":
- prefix: "ima"
- body: "import ${1:*} as ${2:name} from '${3:module}';"
- "assert.equal":
- prefix: "ase"
- body: "assert.equal(${1:actual}, ${2:expected})"
- "assert.notEqual":
- prefix: "asn"
- body: "assert.notEqual(${1:actual}, ${2:expected})"
- "assert.deepEqual":
- prefix: "asd"
- body: "assert.deepEqual(${1:actual}, ${2:expected})"
- "event handler":
- prefix: "on"
- body: """
- ${1:emitter}.on('${2:event}', (${3:arguments}) => {
- \t${0}
- });
- """
- "chain event handler":
- prefix: ".on"
- body: ".on('${2:event}', (${3:arguments}) => {${0}})"
- "require":
- prefix: "re"
- body: "require('${1:module}')"
- "exports.member":
- prefix: "em"
- body: "exports.${1:member} = ${2:value};"
- "module.exports":
- prefix: "me"
- body: "module.exports = ${1:name};"
- "module as class":
- prefix: "mc"
- body: """
- var ${1:name} = (function () {
- \tfunction ${1:name}(${2:arguments}) {
- \t\t${0}
- \t}
- \treturn ${1:name};
- })();
- module.exports = ${1:name};
- """
- "Express middleware":
- prefix: "xm"
- body: """
- function (req, res${1:, next}) {
- \t${0}
- }
- """
- "Express error handler":
- prefix: "xerr"
- body: """
- function (err, req, res, next) {
- \t${0}
- }
- """
- "key/value pair":
- prefix: ":"
- body: "${1:key}: ${2:'value'}"
- "method":
- prefix: "m"
- body: """
- ${1:method}(${2:arguments}) {
- \t${0}
- }
- """
- "getter":
- prefix: "get"
- body: """
- get ${1:property}() {
- \t${0}
- }
- """
- "setter":
- prefix: "set"
- body: """
- set ${1:property}(${2:value}) {
- \t${0}
- }
- """
- "getter + setter":
- prefix: "gs"
- body: """
- get ${1:property}() {
- \t${0}
- }
- set ${1:property}(${2:value}) {
- \t
- }
- """
- "prototype method":
- prefix: "proto"
- body: """
- ${1:Class}.prototype.${2:method} = function (${3:arguments}) {
- \t${0}
- };
- """
- "chain prototype method":
- prefix: ".proto"
- body: """
- .prototype.${2:methodName} = function (${3:arguments}) {
- \t${0}
- }
- """
- "Object.assign":
- prefix: "a"
- body: "Object.assign(${1:dest}, ${2:source})"
- "Object.assign copy":
- prefix: "ac"
- body: "Object.assign({}, ${1:original}, ${2:source})"
- "return":
- prefix: "r"
- body: "return ${0};"
- "return this":
- prefix: "rth"
- body: "return this;"
- "return null":
- prefix: "rn"
- body: "return null;"
- "return true":
- prefix: "rt"
- body: "return true;"
- "return false":
- prefix: "rf"
- body: "return false;"
- "return 0":
- prefix: "r0"
- body: "return 0;"
- "return -1":
- prefix: "r-1"
- body: "return -1;"
- "return complex value":
- prefix: "rc"
- body: """
- return (
- \t${0}
- );
- """
- "return promise":
- prefix: "rp"
- body: """
- return new Promise((resolve, reject) => {
- \t${0}
- });
- """
- "setTimeout":
- prefix: "st"
- body: """
- setTimeout(() => {
- \t${0}
- }, ${1:delay});
- """
- "setInterval":
- prefix: "si"
- body: """
- setInterval(() => {
- \t${0}
- }, ${1:delay});
- """
- "setImmediate":
- prefix: "sim"
- body: """
- setImmediate(() => {
- \t${0}
- });
- """
- "process nextTick":
- prefix: "nt"
- body: """
- process.nextTick(() => {
- \t${1:}
- });
- """
- "String":
- prefix: "S"
- body: "String"
- "Number":
- prefix: "N"
- body: "Number"
- "Object":
- prefix: "O"
- body: "Object"
- "Array":
- prefix: "A"
- body: "Array"
- "Date":
- prefix: "D"
- body: "Date"
- "RegExp":
- prefix: "Rx"
- body: "RegExp"
- "typeof":
- prefix: "tof"
- body: "typeof ${1:source} === '${2:undefined}'"
- "instanceof":
- prefix: "iof"
- body: "${1:source} instanceof ${2:Object}"
Add Comment
Please, Sign In to add comment