Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat argv to object #42

Merged
merged 1 commit into from
Aug 2, 2024
Merged

Feat argv to object #42

merged 1 commit into from
Aug 2, 2024

Conversation

aegenet
Copy link
Owner

@aegenet aegenet commented Aug 2, 2024

Convert an array of command line arguments (argv) to an object.

import { argvToObject } from '@aegenet/belt-argv-to-obj';

const argv = ['--name', 'John', '--age', '25'];
const result = argvToObject(argv);
//=> { name: 'John', age: 25 }
import { argv } from 'node:process';
import { argvToObject } from '@aegenet/belt-argv-to-obj';

// --name John --age 25
const result = argvToObject(argv.slice(2));
//=> { name: 'John', age: 25 }

@aegenet aegenet self-assigned this Aug 2, 2024
@aegenet aegenet merged commit c27ae9e into master Aug 2, 2024
5 checks passed
@aegenet aegenet deleted the feat-argv-to-obj branch August 2, 2024 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant