pinafore/src/routes/_utils/decodeURIComponentWithPluses.js
2019-02-13 18:38:44 -08:00

7 lines
337 B
JavaScript

// Per the web share target spec: https://wicg.github.io/web-share-target/
// U+0020 (SPACE) characters are encoded as "+", due to the use of
// application/x-www-form-urlencoded encoding, not "%20" as might be expected.
export function decodeURIComponentWithPluses (text) {
return text.split('+').map(decodeURIComponent).join(' ')
}