Created
May 27, 2015 03:02
-
-
Save uiur/968669b0ca8bd1ce70f8 to your computer and use it in GitHub Desktop.
Atom javascript snippets that comform to JavaScript Standard Style
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'.source.js': | |
'Prototype': | |
'prefix': 'proto' | |
'body': '${1:class_name}.prototype.${2:method_name} = function (${3:first_argument}) {\n\t${0:// body...}\n}' | |
'Function': | |
'prefix': 'fun' | |
'body': 'function ${1:function_name} (${2:argument}) {\n\t${0:// body...}\n}' | |
'Generator': | |
'prefix': 'gen', | |
'body': 'function* ${1:function_name} (${2:argument}) {\n\t${0:// body...}\n}' | |
'Immediately-Invoked Function Expression': | |
'prefix': 'iife' | |
'body': '(function() {\n\t${1:\'use strict\';\n}\t$2\n}())' | |
'log': | |
'prefix': 'log' | |
'body': 'console.log($1)$0' | |
'warn': | |
'prefix': 'warn' | |
'body': 'console.warn($1)$0' | |
'error': | |
'prefix': 'error' | |
'body': 'console.error($1)$0' | |
'inspect': | |
'prefix': 'inspect' | |
'body': 'console.log(require(\'util\').inspect($0, { depth: null }))' | |
'new Promise': | |
'prefix': 'prom' | |
'body': 'new Promise(function(resolve, reject) {\n\t$1\n})$0' | |
'setInterval function': | |
'prefix': 'interval' | |
'body': 'setInterval(${2:function () {\n\t$3\n}}, ${1:10})' | |
'setTimeout function': | |
'prefix': 'timeout' | |
'body': 'setTimeout(${2:function () {\n\t$3\n}}, ${1:10})' | |
'CommonJS require': | |
'prefix': 'req' | |
'body': 'var ${1:module} = require(\'${1:module}\')' | |
'Class': | |
'prefix': 'class' | |
'body': 'class ${1:ClassName} {\n\tconstructor ($2) {\n\t\t$3\n\t}\n}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just copy and paste to
snippets.cson
in your atom setting dir