Skip to content

Commit

Permalink
[readme]: add description of ECMAScript
Browse files Browse the repository at this point in the history
  • Loading branch information
unikounio committed Mar 11, 2024
1 parent 6715df1 commit 24a4bc7
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,13 @@ fanciful decoration.

# example

Example files: [example/parse.js](./example/parse.js) (CommonJS) / [example/parse.mjs](./example/parse.mjs) (ECMAScript)

``` js
var argv = require('minimist')(process.argv.slice(2));
const minimist = require('minimist'); // (for CommonJS)
// import minimist from 'minimist'; // (for ECMAScript)

const argv = minimist(process.argv.slice(2));
console.log(argv);
```

Expand All @@ -42,10 +47,10 @@ $ node example/parse.js -x 3 -y 4 -n5 -abc --beep=boop --no-ding foo bar baz
# methods

``` js
var parseArgs = require('minimist')
const parseArgs = require('minimist')
```

## var argv = parseArgs(args, opts={})
## const argv = parseArgs(args, opts={})

Return an argument object `argv` populated with the array arguments from `args`.

Expand Down

0 comments on commit 24a4bc7

Please sign in to comment.