lossy-encode-to-uri

Lossy encode to URI component

Usage no npm install needed!

<script type="module">
  import lossyEncodeToUri from 'https://cdn.skypack.dev/lossy-encode-to-uri';
</script>

README

Lossy encode to URI

NPM version Downloads Rate on Openbase

Performs a lossy transformation into a format that can be inserted into a URI path component.

Requirements

It runs inside any webbrowser (starting at IE11 and up) or NodeJS environment.

It has zero dependencies on other modules.

Reference documentation

  • LossyEncode2URI.encode(string)
    Performs a lossy transformation of string into a format that can be inserted into a URI path component:
    • Cast to lowercase.
    • Replace diacritics by their ASCII equivalent.
    • Replace all strings of non-alphanumeric characters with single dashes.
    • Strip dashes from start and end.

References

Card-carrying member of the zerodeps movement.