encodeurl

  • Version 3.0.1
  • Published
  • 10.7 kB
  • No dependencies
  • MIT license

Install

npm i encodeurl
yarn add encodeurl
pnpm add encodeurl

Overview

Encode a URL to a percent-encoded form, excluding already-encoded sequences

Index

Functions

Functions

function encodeUrl

encodeUrl: (url: string) => string;
  • Encode a URL to a percent-encoded form, excluding already-encoded sequences.

    This function will take an already-encoded URL and encode all the non-URL code points. This function will not encode the "%" character unless it is not part of a valid sequence (%20 will be left as-is, but %foo will be encoded as %25foo).

    This encode is meant to be "safe" and does not throw errors. It will try as hard as it can to properly encode the given URL, including replacing any raw, unpaired surrogate pairs with the Unicode replacement character prior to encoding.

    Parameter url

    {string}

    Modifiers

    • @public

Package Files (1)

Dependencies (0)

No dependencies.

Dev Dependencies (7)

Peer Dependencies (0)

No peer dependencies.

Badge

To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/encodeurl.

  • Markdown
    [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/encodeurl)
  • HTML
    <a href="https://www.jsdocs.io/package/encodeurl"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>