Skip to content

Commit

Permalink
feat!: replace query-string with fast-querystring
Browse files Browse the repository at this point in the history
  • Loading branch information
ModyQyW committed Jan 3, 2024
1 parent f6d1e77 commit 3a26214
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions src/utils/buildUrl.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ describe('utils::buildUrl', () => {
},
}),
// ).toEqual('/foo?foo%5Bbar%5D=baz'); // qs
).toEqual('/foo?foo=%5Bobject%20Object%5D'); // query-string
// ).toEqual('/foo?foo=%5Bobject%20Object%5D'); // query-string
).toEqual('/foo?foo='); // fast-querystring
});

it('should support date params', () => {
Expand All @@ -34,9 +35,8 @@ describe('utils::buildUrl', () => {
date: date,
}),
// ).toEqual('/foo?date=' + encodeURIComponent(date.toISOString())); // qs
).toEqual(
'/foo?date=' + encodeURIComponent(date.toString()).replace('(', '%28').replace(')', '%29'),
); // query-string
// ).toEqual('/foo?date=' + encodeURIComponent(date.toString()).replace('(', '%28').replace(')', '%29')); // query-string
).toEqual('/foo?date='); // fast-querystring
});

it('should support array params', () => {
Expand Down Expand Up @@ -72,7 +72,8 @@ describe('utils::buildUrl', () => {
length: 5,
}),
// ).toEqual('/foo?query=bar&start=0&length=5'); // qs
).toEqual('/foo?length=5&query=bar&start=0'); // query-string
// ).toEqual('/foo?length=5&query=bar&start=0'); // query-string
).toEqual('/foo?query=bar&start=0&length=5'); // fast-querystring
});

it('should correct discard url hash mark', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/buildUrl.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import qs from 'query-string';
import qs from 'fast-querystring';
import type { UnParams, UnParamsSerializer } from '../types';

export const buildUrl = (url: string, params?: UnParams, paramsSerializer?: UnParamsSerializer) => {
Expand Down

0 comments on commit 3a26214

Please sign in to comment.