Skip to content
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ const parseArgs = ({
);

const result = {
values: {},
values: { __proto__: null },
positionals: []
};

Expand Down
14 changes: 14 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -378,3 +378,17 @@ test('invalid short option length', () => {
code: 'ERR_INVALID_ARG_VALUE'
});
});

test('null prototype: when no options then values.toString is undefined', () => {
const result = parseArgs({ args: [] });
assert.strictEqual(result.values.toString, undefined);
});

test('null prototype: when --toString then values.toString is true', () => {
const args = ['--toString'];
const options = { toString: { type: 'boolean' } };
const expectedResult = { values: { __proto__: null, toString: true }, positionals: [] };

const result = parseArgs({ args, options });
assert.deepStrictEqual(result, expectedResult);
});