Skip to content

Commit

Permalink
feat(resume): refine utils
Browse files Browse the repository at this point in the history
  • Loading branch information
hankliu62 committed May 17, 2024
1 parent fc4d7c1 commit 1c46c3e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
16 changes: 7 additions & 9 deletions src/utils/platform.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export function isServer() {
return typeof window === "undefined";
return typeof window === 'undefined';
}

export function setPageTitle(title: string) {
Expand All @@ -11,17 +11,15 @@ export function setPageTitle(title: string) {
}

export function getUrl() {
return isServer()
? ""
: window.location.href.replace(window.location.hash, "");
return isServer() ? '' : window.location.href.replace(window.location.hash, '');
}

export function getHref() {
return isServer() ? "" : window.location.href;
return isServer() ? '' : window.location.href;
}

export function getUrlOrigin() {
return isServer() ? "" : window.location.origin;
return isServer() ? '' : window.location.origin;
}

export function isDebugJSSDK() {
Expand All @@ -33,15 +31,15 @@ export function isWechat() {
}

export function getSignatureUrl() {
return isServer() ? "" : `${getUrlOrigin()}/v1/api/wechat/getJsConfig`;
return isServer() ? '' : `${getUrlOrigin()}/v1/api/wechat/getJsConfig`;
}

export function isBuildRelease() {
return process.env.NODE_ENV === "production";
return process.env.NODE_ENV === 'production';
}

export function isEnvProduction() {
return process.env.ENV === "production";
return process.env.ENV === 'production';
}

export function clientWidth() {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
* @returns
*/
export function getRoutePrefix(): string {
return process.env.ROUTE_PREFIX || "";
return process.env.ROUTE_PREFIX || '';
}

0 comments on commit 1c46c3e

Please sign in to comment.