Skip to content

optimazition of code #4588

@zh-lx

Description

@zh-lx

Is your feature request related to a problem? Please describe.

This is an optimazition of code.

Describe the solution you'd like

The following line of code comes from https://github.com/axios/axios/blob/master/lib/adapters/http.js#L403:

reject(!cancel || (cancel && cancel.type) ? new CanceledError() : cancel);

It can be optimized as follows:

reject(!cancel || cancel.type ? new CanceledError() : cancel);

Describe alternatives you've considered

When the code is executed to (cancel && cancel.type), it means !cancel is false, so cancel is true, we can get cancel.type directly.

Additional context

no more

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions