0.4.8 • Published 5 months ago

extract-from-argv v0.4.8

Weekly downloads
-
License
MIT
Repository
github
Last release
5 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

5 months ago

0.4.7

7 months ago

0.4.6

11 months ago

0.4.5

11 months ago

0.4.4

12 months ago

0.4.3

1 year ago

0.4.1

1 year ago

0.4.2

1 year 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

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago