parse
函数把 query string 解析成对象(支持还原嵌套对象/数组结构,和 `stringify` 互为逆操作)
签名
function parse(str: string, options?: (IParseOptions<BooleanOptional> & { decoder?: never | undefined; }) | undefined): ParsedQs参数
| 名称 | 类型 | 描述 |
|---|---|---|
| str | string | — |
| options可选 | (IParseOptions<BooleanOptional> & { decoder?: never | undefined; }) | undefined | — |
返回值
ParsedQs
示例
parse('a=1&b[0]=x&b[1]=y') // { a: '1', b: ['x', 'y'] }源码
node_modules/.pnpm/@types+qs@6.15.1/node_modules/@types/qs/index.d.ts:78