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

refactor: use prototype #2165

Merged
merged 5 commits into from May 16, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/command.ts
Expand Up @@ -603,9 +603,9 @@ export class CommandInstance {
// If both positionals/options provided, no default was set,
// and if at least one is an array: don't overwrite, combine.
if (
!Object.hasOwnProperty.call(defaults, key) &&
Object.hasOwnProperty.call(argv, key) &&
Object.hasOwnProperty.call(parsed.argv, key) &&
!Object.prototype.hasOwnProperty.call(defaults, key) &&
Object.prototype.hasOwnProperty.call(argv, key) &&
Object.prototype.hasOwnProperty.call(parsed.argv, key) &&
(Array.isArray(argv[key]) || Array.isArray(parsed.argv[key]))
) {
argv[key] = ([] as string[]).concat(argv[key], parsed.argv[key]);
Expand Down
2 changes: 1 addition & 1 deletion lib/yargs-factory.ts
Expand Up @@ -389,7 +389,7 @@ export class YargsInstance {
let aliases: Dictionary<string[]>;

// Skip coerce logic if related arg was not provided
const shouldCoerce = Object.hasOwnProperty.call(argv, keys);
const shouldCoerce = Object.prototype.hasOwnProperty.call(argv, keys);
if (!shouldCoerce) {
return argv;
}
Expand Down