A Pen by Saras Arya on CodePen.
This file contains 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
/** | |
* logger | |
* @param data object | |
*/ | |
export const log = (data: any) => { | |
console.log('------------------logger------------------------'); | |
Object.entries(data || {}).forEach((t, i) => { | |
console.log(`\n ${i}. \t ${t[0]} is ${JSON.stringify(t[1], null, 2)}`); | |
}); | |
console.log('------------------logger------------------------'); |
This file contains 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
import { Dispatch } from 'redux'; | |
export interface IDom { | |
value?: string; | |
name?: string; | |
className?: string; | |
style?: any; | |
} | |
export interface IEvent { | |
target?: IDom; |
This file contains 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
/** | |
* Code snippet to throw an error for Null or Undefined | |
* Container = object containing variables for example | |
* if we want to assert that a variable x is not null or undefined | |
* we can use function like this | |
* let x; | |
* assertNonNull({x}) // if x is null or undefined, | |
* this function will throw appropriate error | |
*/ | |
export const assertNonNull = (container: any) => { |
This file contains 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
sudo rm -rf ~/.npm ~/.nvm ~/node_modules ~/.node-gyp ~/.npmrc ~/.node_repl_history | |
sudo rm -rf /usr/local/bin/npm /usr/local/bin/node-debug /usr/local/bin/node /usr/local/bin/node-gyp | |
sudo rm -rf /usr/local/share/man/man1/node* /usr/local/share/man/man1/npm* | |
sudo rm -rf /usr/local/include/node /usr/local/include/node_modules | |
sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /usr/local/lib/dtrace/node.d | |
sudo rm -rf /opt/local/include/node /opt/local/bin/node /opt/local/lib/node | |
sudo rm -rf /usr/local/share/doc/node | |
sudo rm -rf /usr/local/share/systemtap/tapset/node.stp | |
brew uninstall node |
This file contains 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
const fs = require('fs-extra'); | |
const folders = [ | |
{ | |
path: './build/static/css', | |
regex: /^(main).[\w]*.css$/, | |
outputFile: '../public-pages/style/sme.css' | |
}, | |
{ | |
path: './build/static/js', | |
regex: /^(main).[\w]*.js$/, |
This file contains 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
let customer = { | |
name: "Carl", | |
details: { age: 82 }, | |
surname: "" | |
}; | |
console.log(customer?.city ?? "Unknown city";); // Unknown city | |
console.log(customer?.city ?? "Unknown city";); // Unknown city | |
console.log(customer?.surname ?? "Unknown city";); // '' | |
console.log(customer?.surname || "Unknown city";); // Unknown city |
NewerOlder