Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on Mar 31, 2024 via pnpm

yargs-parser 20.2.4

the mighty option parser used by yargs
Package summary
Share
0
issues
1
license
1
ISC
Package created
23 Jan 2016
Version published
9 Nov 2020
Maintainers
3
Total deps
1
Direct deps
0
License
ISC

Issues

0
This package has no issues

Licenses

ISC License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
Cannot
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
yargs-parser@20.2.4
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

0
All Dependencies CSV
β“˜ This is a list of yargs-parser 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities

Visualizations

Frequently Asked Questions

What does yargs-parser do?

Yargs-parser is a mighty command-line option parser used by Yargs. It provides functionality to parse command line arguments, returning a simple mapping of keys and values. This makes it a trusted tool for developers who require to work with command line arguments.

How do you use yargs-parser?

To use yargs-parser, you start by installing it into your project using npm:

npm i yargs-parser --save

Then, in your JavaScript file, you can require it and use it to parse command line arguments like so:

const argv = require('yargs-parser')(process.argv.slice(2));
console.log(argv);

The above code will log the parsed arguments to the console.

Additionally, you can also parse a string with yargs-parser:

const argv = require('yargs-parser')('--foo=99 --bar=33');
console.log(argv);

Moreover, yargs-parser can also convert an array of mixed types before passing it for parsing:

const parse = require('yargs-parser');
parse(['-f', 11, '--zoom', 55].join(' '));   // <-- array to string
parse(['-f', 11, '--zoom', 55].map(String)); // <-- array of strings

In a modern JavaScript environment, you can use the import syntax to import yargs-parser:

import parser from 'yargs-parser';

const argv = parser('--foo=99 --bar=9987930', {
  string: ['bar']
});
console.log(argv);

This also works in a web browser:

<!doctype html>
<body>
  <script type="module">
    import parser from "https://unpkg.com/yargs-parser@19.0.0/browser.js";

    const argv = parser('--foo=99 --bar=9987930', {
      string: ['bar']
    });
    console.log(argv);
  </script>
</body>

Where are the yargs-parser docs?

The comprehensive documentation for yargs-parser can be found directly on the repository's README file on GitHub. It includes detailed usage instructions, examples, and API references to help get the most out of yargs-parser. Additionally, you can also visit the yargs website for more examples and information.