Comments (15)
CLIを話題にするなら、引数とオプションを扱う感じがする。
引数パース -> オプションオブジェクトに変換 -> 関数に渡す
デフォルトオプションをObject.assign
とデフォルト引数で扱う方法をカバーできてると良い気がする(ものすごく典型的なユースケース)
const DEFAULTS = {
logLevel: 0,
outputFormat: 'html'
};
function processContent(options) {
options = Object.assign({}, DEFAULTS, options); // (A)
···
}
from js-primer.
callbackベースの標準API(fsとか)をPromiseでラップしてメソッドチェーンで処理するケース
from js-primer.
なかなかいい題材が思いつかない…
npmパッケージの活用ということでとりあえずcommanderは入れようと思っているけど、生でprocess.argvに触るときに[0]と[1]に何が入っているみたいな話は別に必要そう
from js-primer.
ファイルパスを受け取って読み取って何かしら改変して吐き出す、と思っていたけどどう改変するとユースケースっぽいか悩んでる。ただのチュートリアルならアッパーケースにするとかだけでもいいけど、ユースケースとなるともうちょっと「応用すれば実用的かも」くらいな題材がいい気がしている
from js-primer.
https://www.npmjs.com/package/table を使って、CSVを読み込んでテーブルのアスキーアートを出力するのは面白そうだなと思ったけど、このパッケージがライブラリをデフォルトモジュールで出力していて const table = require('table');
で使えないので微妙
from js-primer.
AjaxサンプルのほうでもGitHub API使ったし、こっちでもmarkdown -> html 変換とかやるといいかも
from js-primer.
https://github.com/laco0416/plain-node-cli
from js-primer.
Node.js バージョン管理ツールとElectronベースのインストーラーの議論があるのか。
https://github.com/nodejs/version-management
https://github.com/nodejs/installer
from js-primer.
The Node Beginner Book » A comprehensive Node.js tutorial
これ一応今もアップデートされてるんだな
from js-primer.
JSPatterns.com » Blog Archive » Node shell scripting
今時めずらしいNode.jsの本当に入門的な記事が書かれてた
from js-primer.
今時のフロントエンド開発2017 (2. 構築編) - Qiita
npmのオプションテーブルわかりやすい
from js-primer.
とりあえず完了
from js-primer.
そういえば console.assert
は https://asciidwango.github.io/js-primer/basic/implicit-coercion/#%E3%82%B3%E3%83%A9%E3%83%A0-nan%E3%81%AFnot-a-number%E3%81%A0%E3%81%91%E3%81%A9number%E5%9E%8B のコラムで軽く触れていることを思い出しました
from js-primer.
Object.assignを {...obj}
に書き直す
from js-primer.
ひとまず書き終わってるのでcloseする
from js-primer.
Related Issues (20)
- P369: `https://api.github.com/users/GitHubユーザーID` のコード処理
- P395: 脚注がMarkdownのコードになっている
- P369: セクションタイトルがリンクになっている
- P407: "31.5.1 アプリケーションをモジュールに分割する"がリンクになっている
- TODOアプリ: EventTargetのNode.jsについて
- TODOアプリ: Viewの対応関係の強調
- P471: 索引の .at がリンクになっている HOT 1
- Publish: 細かいレイアウト崩れ
- P416: file:/// がリンクになっている
- anonymous functionの訳語について(匿名関数 or 無名関数) HOT 1
- 脱字の報告
- TodoItemView、TodoListViewのJSDocのparamについて HOT 1
- ECMAScript 2023の対応 HOT 10
- Publish: npm 8 → npm 9 HOT 1
- Publish: 非同期の図がモノクロだと違いがわからない HOT 4
- ES2023: proposal-array-find-from-last HOT 1
- ES2023: Symbol as a Key HOT 1
- ES2023: Change Array by copy HOT 8
- website: 書籍へのリンクを改訂2版に変更する HOT 1
- 電子書籍のリンクを改訂2版に変更する
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from js-primer.