@popovmp/options-parser

1.3.0 • Public • Published

A Simple CLI Options Parser

Parses options.

Features:

  • Converts the keys to camel-case.
  • Collects multiple options in an array.
  • Converts the options to the correct data types: string, null, boolean, or number.

Input:

node foo --foo bar --foo-bar boo --FooBar 42 --foo_bar_baz null false 3.14 

Code:

const {parceOptions} = require("@popovmp@options-parser");
const options = parseOptions();
console.log( JSON.stringify(options) );

Output:

{
  "foo": "bar",
  "fooBar": ["boo", 42],
  "fooBarBaz": [null, false, 3.14]
}

/@popovmp/options-parser/

    Package Sidebar

    Install

    npm i @popovmp/options-parser

    Weekly Downloads

    0

    Version

    1.3.0

    License

    MIT

    Unpacked Size

    4.96 kB

    Total Files

    4

    Last publish

    Collaborators

    • popovmp