Giter Club home page Giter Club logo

Comments (15)

azu avatar azu commented on July 19, 2024

CLIを話題にするなら、引数とオプションを扱う感じがする。

引数パース -> オプションオブジェクトに変換 -> 関数に渡す

デフォルトオプションをObject.assignとデフォルト引数で扱う方法をカバーできてると良い気がする(ものすごく典型的なユースケース)

    const DEFAULTS = {
        logLevel: 0,
        outputFormat: 'html'
    };
    function processContent(options) {
        options = Object.assign({}, DEFAULTS, options); // (A)
        ···
    }

from js-primer.

lacolaco avatar lacolaco commented on July 19, 2024

callbackベースの標準API(fsとか)をPromiseでラップしてメソッドチェーンで処理するケース

from js-primer.

lacolaco avatar lacolaco commented on July 19, 2024

なかなかいい題材が思いつかない…

npmパッケージの活用ということでとりあえずcommanderは入れようと思っているけど、生でprocess.argvに触るときに[0]と[1]に何が入っているみたいな話は別に必要そう

from js-primer.

lacolaco avatar lacolaco commented on July 19, 2024

ファイルパスを受け取って読み取って何かしら改変して吐き出す、と思っていたけどどう改変するとユースケースっぽいか悩んでる。ただのチュートリアルならアッパーケースにするとかだけでもいいけど、ユースケースとなるともうちょっと「応用すれば実用的かも」くらいな題材がいい気がしている

from js-primer.

lacolaco avatar lacolaco commented on July 19, 2024

https://www.npmjs.com/package/table を使って、CSVを読み込んでテーブルのアスキーアートを出力するのは面白そうだなと思ったけど、このパッケージがライブラリをデフォルトモジュールで出力していて const table = require('table'); で使えないので微妙

from js-primer.

lacolaco avatar lacolaco commented on July 19, 2024

AjaxサンプルのほうでもGitHub API使ったし、こっちでもmarkdown -> html 変換とかやるといいかも

from js-primer.

lacolaco avatar lacolaco commented on July 19, 2024

https://github.com/laco0416/plain-node-cli

from js-primer.

azu avatar azu commented on July 19, 2024

Node.js バージョン管理ツールとElectronベースのインストーラーの議論があるのか。
https://github.com/nodejs/version-management
https://github.com/nodejs/installer

from js-primer.

azu avatar azu commented on July 19, 2024

The Node Beginner Book » A comprehensive Node.js tutorial
これ一応今もアップデートされてるんだな

from js-primer.

azu avatar azu commented on July 19, 2024

JSPatterns.com » Blog Archive » Node shell scripting
今時めずらしいNode.jsの本当に入門的な記事が書かれてた

from js-primer.

azu avatar azu commented on July 19, 2024

今時のフロントエンド開発2017 (2. 構築編) - Qiita
npmのオプションテーブルわかりやすい

from js-primer.

lacolaco avatar lacolaco commented on July 19, 2024

とりあえず完了

from js-primer.

azu avatar azu commented on July 19, 2024

そういえば console.asserthttps://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.

lacolaco avatar lacolaco commented on July 19, 2024

Object.assignを {...obj} に書き直す

from js-primer.

lacolaco avatar lacolaco commented on July 19, 2024

ひとまず書き終わってるのでcloseする

from js-primer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.