- From: Cyril Auburtin <notifications@github.com>
- Date: Tue, 21 Feb 2017 16:04:16 -0800
- To: whatwg/url <url@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Wednesday, 22 February 2017 00:04:48 UTC
ah nice, I was doing that too
```
function QS(data) {
if (typeof data=='string') {
return /^\w+:\/\//.test(data) ? new URL(data).searchParams : new URLSearchParams(data);
}
var qs = new URLSearchParams();
for (var i in data) { // null and undefined are filtered
if (typeof data[i] == 'string' || typeof data[i] == 'number') {
qs.append(i, data[i]);
} else if (Array.isArray(data[i])) {
data[i].forEach(v => qs.append(i, v));
}
}
return qs;
}
```
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/url/issues/256#issuecomment-281523548
Received on Wednesday, 22 February 2017 00:04:48 UTC