File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -18,11 +18,11 @@ export type QueryObject = Record<string, QueryValue | QueryValue[]>;
18
18
19
19
export type ParsedQuery = Record < string , string | string [ ] > ;
20
20
21
- const EmptyObject = /* @__PURE__ */ ( ( ) => {
22
- const C = function ( ) { } ;
23
- C . prototype = Object . create ( null ) ;
24
- return C ;
25
- } ) ( ) as unknown as { new ( ) : any } ;
21
+ // const EmptyObject = /* @__PURE__ */ (() => {
22
+ // const C = function () {};
23
+ // C.prototype = Object.create(null);
24
+ // return C;
25
+ // })() as unknown as { new (): any };
26
26
27
27
/**
28
28
* Parses and decodes a query string into an object.
@@ -37,7 +37,9 @@ const EmptyObject = /* @__PURE__ */ (() => {
37
37
export function parseQuery < T extends ParsedQuery = ParsedQuery > (
38
38
parametersString = "" ,
39
39
) : T {
40
- const object : ParsedQuery = new EmptyObject ( ) ;
40
+ // TODO: Use new EmptyObject() instead of Object.create(null) for better performance in next major version
41
+ // https://github.com/unjs/ufo/pull/290
42
+ const object : ParsedQuery = Object . create ( null ) ;
41
43
if ( parametersString [ 0 ] === "?" ) {
42
44
parametersString = parametersString . slice ( 1 ) ;
43
45
}
You can’t perform that action at this time.
0 commit comments