From dd1ccac70698710268c2b7ab75ef13df40f6a47a Mon Sep 17 00:00:00 2001 From: jaredvu Date: Fri, 16 Feb 2024 14:27:49 -0800 Subject: [PATCH] parseHash -> parseLocationHash --- src/App.tsx | 4 ++-- src/lib/__test__/urlUtils.spec.ts | 8 ++++---- src/lib/urlUtils.ts | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index da1af89..fb52216 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -35,7 +35,7 @@ import { NotificationsToastArea } from '@/layout/NotificationsToastArea'; import { DialogManager } from '@/layout/DialogManager'; import { GlobalCommandDialog } from '@/views/dialogs/GlobalCommandDialog'; -import { parseHash } from '@/lib/urlUtils'; +import { parseLocationHash } from '@/lib/urlUtils'; import { config } from '@/lib/wagmi'; import { breakpoints } from '@/styles'; @@ -75,7 +75,7 @@ const Content = () => { if (location.hash === '') { return ''; } - return parseHash(location.hash); + return parseLocationHash(location.hash); }, [location.hash]); return ( diff --git a/src/lib/__test__/urlUtils.spec.ts b/src/lib/__test__/urlUtils.spec.ts index aaee71a..40ad600 100644 --- a/src/lib/__test__/urlUtils.spec.ts +++ b/src/lib/__test__/urlUtils.spec.ts @@ -1,14 +1,14 @@ import { describe, expect, it } from 'vitest'; -import { parseHash } from '@/lib/urlUtils'; +import { parseLocationHash } from '@/lib/urlUtils'; -describe('parseHash', () => { +describe('parseLocationHash', () => { it('returns the path separated from hash', () => { const hash = '#/markets'; - expect(parseHash(hash)).toEqual('/markets'); + expect(parseLocationHash(hash)).toEqual('/markets'); }); it('returns the path and query string separated from hash', () => { const hash = '#/markets?displayinitializingmarkets=true'; - expect(parseHash(hash)).toEqual('/markets?displayinitializingmarkets=true'); + expect(parseLocationHash(hash)).toEqual('/markets?displayinitializingmarkets=true'); }); }); diff --git a/src/lib/urlUtils.ts b/src/lib/urlUtils.ts index 39015f6..be5694e 100644 --- a/src/lib/urlUtils.ts +++ b/src/lib/urlUtils.ts @@ -2,7 +2,7 @@ * @param hash location.hash * @returns path and query string if hash parameter is not empty */ -export const parseHash = (hash: string) => { +export const parseLocationHash = (hash: string) => { if (!hash || hash.length === 0) return ''; // Remove '#' and split by '?'