Skip to content

origin defaults to "null" #38

Open
@gt53

Description

@gt53

I noticed that origin defaults to "null" unlike any of the other default values that the parser returns and was wondering if that is intentional. Here's what I get when passing an empty string to the parser:

{
  protocol: '',
  slashes: false,
  hash: '',
  query: '',
  pathname: '',
  auth: '',
  host: '',
  port: '',
  hostname: '',
  password: '',
  username: '',
  origin: 'null',
  href: ''
}

Besides the inconsistency, "null" evaluates truthily, which seems potentially problematic to url-parse users.

If an empty string is ultimately desired for origin when no value is present, I can submit a PR for that.

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