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
hello: | |
world: | |
webpack |
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
{ | |
"components.App.hello": "hello {name}", | |
"components.App.welcome": "Welcome" | |
} |
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
async function f() { | |
const x = await g() | |
} |
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
let name = ‘ゲスト’ | |
try { | |
name = awiat getName() | |
} catch (err) { } | |
console.log(`ようこそ ${name}さん`) |
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
let name = ‘ゲスト’ | |
try { | |
name = awiat getName() | |
} catch (err) { } | |
console.log(`ようこそ ${name}さん`) | |
// => ようこそ ゲストさん | |
/// ↓ ↓ ↓ | |
const name = await getName().catch(() => ‘ゲスト’) |
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
try { | |
await f() | |
} catch (err) { | |
handleErr1(err) | |
} | |
try { | |
await g() | |
} catch (err) { | |
handleErr2(err) | |
} |
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
$ mkdir cli-app-demo | |
$ cd cli-app-demo | |
$ yarn init -y | |
$ touch cli.js |
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
'use strict' | |
const parse = require('mri') // or require('minimist') | |
// node cli.js --name tj | |
const { name } = parse(process.argv.slice(2)) | |
const jsers = { | |
tj: ['express', 'koa', 'mocha', 'stylus', 'co'], | |
sindersorhus: ['ava', 'chalk', 'xo', 'yaomen'], | |
rauchg: ['socket.io', 'next.js'], |
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
$ node cli.js --name tj | |
[ 'express', 'koa', 'mocha', 'stylus', 'co' ] | |
$ chmod +x cli.js | |
$ cli.js --name kittens | |
[ 'babel', 'yarn' ] |
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
$ yarn add mri // or minimist |