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

Replace use of arguments.length #1235

Merged
merged 1 commit into from
Apr 3, 2020

Conversation

shadowspawn
Copy link
Collaborator

@shadowspawn shadowspawn commented Apr 2, 2020

Pull Request

Problem

The use of arguments.length to test for parameters in the get/set routines leads to misleading editor auto-generated help. This is a documentation problem for the author rather than a functional problem.

For example, Visual Studio Code displays extra parameters for any routine which has a call to arguments.length:

(method) Command.name(str?: string, ...args: any[]): string | Command

Solution

Replace uses of arguments.length with test of parameter against undefined. Now VSC displays:

(method) Command.name(str?: string): string | Command

Also:

  • tightened special case behaviour in alias for adding alias for executable subcommand
  • refactored usage to only calculate the default usage string when required

Copy link
Collaborator

@abetomo abetomo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@shadowspawn shadowspawn added the pending release Merged into a branch for a future release, but not released yet label Apr 3, 2020
@shadowspawn shadowspawn merged commit b59adfc into tj:develop Apr 3, 2020
@shadowspawn shadowspawn deleted the feature/elimimate-arguments branch April 3, 2020 06:00
@shadowspawn shadowspawn removed the pending release Merged into a branch for a future release, but not released yet label Apr 25, 2020
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.

2 participants