Add node querystring polyfill (#4370)

This commit is contained in:
crowlKats 2020-03-14 21:43:49 +01:00 committed by GitHub
parent 92bbce04b9
commit 9648d3da14
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 106 additions and 1 deletions

View file

@ -0,0 +1,30 @@
const { test } = Deno;
import { assertEquals } from "../testing/asserts.ts";
import { stringify, parse } from "./querystring.ts";
test({
name: "stringify",
fn() {
assertEquals(
stringify({
a: "hello",
b: 5,
c: true,
d: ["foo", "bar"]
}),
"a=hello&b=5&c=true&d=foo&d=bar"
);
}
});
test({
name: "parse",
fn() {
assertEquals(parse("a=hello&b=5&c=true&d=foo&d=bar"), {
a: "hello",
b: "5",
c: "true",
d: ["foo", "bar"]
});
}
});