fix: url_encode throws on undefined value, fixes #479

This commit is contained in:
Harttle
2022-02-24 01:14:46 +08:00
parent 2b0c5696bc
commit ca3240c2c4
2 changed files with 12 additions and 2 deletions
+4 -2
View File
@@ -1,2 +1,4 @@
export const urlDecode = (x: string) => x.split('+').map(decodeURIComponent).join(' ')
export const urlEncode = (x: string) => x.split(' ').map(encodeURIComponent).join('+')
import { stringify } from '../../util/underscore'
export const urlDecode = (x: string) => stringify(x).split('+').map(decodeURIComponent).join(' ')
export const urlEncode = (x: string) => stringify(x).split(' ').map(encodeURIComponent).join('+')