Last active
March 24, 2017 10:31
-
-
Save hiroppy/f28edff08588e5c179dce791b8b92fe8 to your computer and use it in GitHub Desktop.
WHATWG URL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { URLSearchParams } = require('url'); | |
const params = new URLSearchParams('foo=bar&hoge=fuga&foo=baz'); | |
// URLSearchParams { 'foo' => 'bar', 'foo' => 'baz', 'hoge' => 'fuga' } | |
console.log(params.toString()); // foo=bar&foo=baz&hoge=fuga | |
params.sort(); | |
// URLSearchParams { 'foo' => 'bar', 'foo' => 'baz', 'hoge' => 'fuga' } | |
console.log(params.toString()); // foo=bar&foo=baz&hoge=fuga |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
L4: Is it okay to sort it still we don't run
sort()
?We should expect
foo=bar&hoge=fuga&foo=baz
?