From 24a4bc71e6a298261d25ac6344d4b4dbebebe261 Mon Sep 17 00:00:00 2001 From: unikounio Date: Mon, 11 Mar 2024 17:28:40 +0900 Subject: [PATCH] [readme]: add description of ECMAScript --- README.md | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 314b501..adf96e8 100644 --- a/README.md +++ b/README.md @@ -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); ``` @@ -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`.