Handy JS Snippets for javascript (react, typescript, etc)
Some often used shortcuts by the team.
console variants
Cursor position is located at pipes. Nice for logging thing: thing
.
console.log('| :', |);
Great for just marking which line number in which file you've placed this.
console.log('***** Here! -> line #XXX in DIR/FILENAME *****');
Console log table for a variable.
console.table()
stringy
For getting a formatted json object stringified for display in the console or UI. Cursor will be ready for you to enter the variable to stringify.
JSON.stringify(your_var, null, 2)
Console log table for a variable.
console.table()
testing
Quickly scaffold out a test describe
block with it
statement.
You may TAB through this code to traverse describe, it, and //test
.
describe('', () => {
it('should...', ()=> {
// test
});
});
Contributing
Please do!