Back to Explore

sindresorhus/normalize-url

GitHub
1 updates · last 90 daysOpen source

Last release:

A JavaScript (npm) package that normalizes URLs by producing a consistent string format. It is useful for displaying, storing, deduplicating, sorting, and comparing URLs, with options to adjust protocols, strip authentication, hashes, query parameters, and other URL parts (and it explicitly does not perform URL sanitization).

Project status

  • Actively maintained: Yes, there was a recent upstream push on 2026-10-14, followed by a v10.0.0 update on 2026-10-14. This is a recent, ongoing cadence rather than a long-running abandonment.
  • Update cadence: The project has seen multiple updates in 2026, including v10.0.0 (2026-10-14) and v9.0.1 (2026-05-20), with prior changes in Feb 2026 (v9.0.0), suggesting an evolving release pattern rather than infrequent maintenance.

AI summary generated

AI-generated from public sources. May be inaccurate. Report

Recent updates

  • v10.0.0

    v10.0.0 of normalize-url targets Node.js 22 and introduces several breaking normalization behavior changes, especially around how query strings are re-serialized and how defaultProtocol validation works. It also reorders how removeDirectoryIndex is applied relative to transformPath, and updates many edge case normalizations for URL stability.

    Breaking
  • v9.0.1

    Release v9.0.1 contains a targeted fix for the `removeExplicitPort` option when the input URL is `localhost:<port>`. It also includes additional test coverage around how the library handles “custom schemes” like `tel:` and `sms:` when `removeExplicitPort` is enabled.

  • v9.0.0

    v9.0.0 introduces a new `customProtocols` option to allow normalization of additional schemes, plus an `emptyQueryValue` option to control how empty query parameters are rendered. The implementation also adds logic to preserve percent-encoded reserved query characters. The release notes are missing a notable behavioral change around how RegExp query filters with `g` or `y` flags are handled.

    BreakingFeatures
  • v8.1.1

    v8.1.1 primarily fixes `removeDirectoryIndex` so it treats trailing slashes consistently. The code diff also includes a small refactor in the Data URL normalization logic (`normalizeDataURL`), even though that is not mentioned in the release notes.

  • v8.1.0

    v8.1.0 introduces two new normalization options, removePath and transformPath, to give callers control over how the URL pathname is handled. It also fixes a specific case where path-like query strings could lose structure when sortQueryParameters is enabled. Overall, the changes are additive plus a targeted behavior fix around query sorting.

    Features
  • v8.0.2

    v8.0.2 focuses on fixing how normalize-url handles encoded backslashes in URL pathnames. The code change ensures that percent-encoded backslashes remain percent-encoded in the normalized output, and new tests were added to lock that behavior in.

  • v8.0.1

    v8.0.1 focuses on fixing how the library interprets protocol-less URLs that include a port. The code change adjusts protocol detection so inputs like a host plus port are normalized using the default protocol rather than being treated as a custom protocol.

    Breaking
  • v8.0.0

    v8.0.0 is a major release of normalize-url that raises the minimum Node.js version to Node 14 and changes how non-HTTP style protocols are treated. It also updates the `defaultProtocol` option to accept `http` or `https` without the trailing colon (with TypeScript type enforcement).

    Breaking
  • v7.2.0

    v7.2.0 introduces a new option, `removeExplicitPort`, to control whether an explicitly provided port in a URL should be stripped during normalization. The release notes only mention this feature, and the code changes align with that by adding the new option to the implementation, typings, README, and tests.

    Features
  • v7.1.0

    This release adds a new `keepQueryParameters` option to `normalize-url`, allowing callers to retain only specific query parameters. The implementation also changes the interaction with the existing `removeQueryParameters` logic so that the new option takes precedence when provided.

    Features
  • v7.0.3

    v7.0.3 contains a targeted fix for query parameter encoding inconsistencies when `sortQueryParameters` is enabled. The implementation changes how the query string is handled after sorting and updates tests accordingly.