Skip to content

Commit

Permalink
[Docs]refactor sample code for clarity between CJS and ESM syntax
Browse files Browse the repository at this point in the history
Co-authored-by: Jordan Harband <ljharb@gmail.com>
  • Loading branch information
unikounio and ljharb authored Mar 13, 2024
1 parent 71bbf3e commit af0b5cc
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ fanciful decoration.
Example files: [example/parse.js](./example/parse.js) (CommonJS) / [example/parse.mjs](./example/parse.mjs) (ECMAScript)

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

const argv = minimist(process.argv.slice(2));
// for ESM
// import minimist from 'minimist'; // (for ECMAScript)
// const argv = minimist(process.argv.slice(2));
console.log(argv);
```

Expand Down

0 comments on commit af0b5cc

Please sign in to comment.