as-uri-encode-decode
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

as-uri-encode-decode

Since decodeURIComponent and encodeURIComponent are not available yet: https://github.com/AssemblyScript/assemblyscript/wiki/Status-and-Roadmap#globals This module provides those functions written in AssemblyScript.

This implementation works for ISO-8859-1 but doesnt always deal with multi byte utf-8 decoding well, e.g. £ which is %C2%A3 in utf8, this would become in ISO-8859-1.

import {decodeURIComponent, encodeURIComponent} from "./urlencoder"


const input = "Hello! This is a test!?!?"

const output = encodeURIComponent(input)

// output = Hello%21%20This%20is%20a%20test%21%3F%21%3F

const result = decodeURIComponent(output)

// result = Hello! This is a test!?!?

Package Sidebar

Install

npm i as-uri-encode-decode

Weekly Downloads

3

Version

1.0.1

License

MIT

Unpacked Size

6.84 kB

Total Files

7

Last publish

Collaborators

  • willoverton