0.4.8 • Published 4 months ago

extract-from-argv v0.4.8

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

extract-from-argv

Extracts arguments that were passed when the Node.js process was launched.

Usage

Pass arguments to the node process and read it

node my-script.js --port=4200

const port = extractFromArgv('--port'); // Returns '4200'

Custom separator

node my-script.js --port:4200

const port = extractFromArgv('--port', { valueSeparator: ':' }); // Returns '4200'

Custom argv object

const port = extractFromArgv('--port', { argv: ['/usr/node', '--port=5000'] }); // Returns '5000'

Arguments without values

node my-script.js --fun-mode

// If an argument without an value is found it returns an empty string
extractFromArgv('--fun-mode'); // Returns ''

// If a argument was not found the function returns null
extractFromArgv('--angry-mode'); // Returns null'
0.4.8

4 months ago

0.4.7

6 months ago

0.4.6

10 months ago

0.4.5

11 months ago

0.4.4

11 months ago

0.4.3

11 months ago

0.4.1

1 year ago

0.4.2

12 months ago

0.4.0

1 year ago

0.3.3

1 year ago

0.3.2

1 year ago

0.3.1

1 year ago

0.3.0

1 year ago

0.1.0

1 year ago

0.0.2

2 years ago

0.0.1

2 years ago