Skip to content

Commit

Permalink
feat(util): 修改isPage函数定义
Browse files Browse the repository at this point in the history
  • Loading branch information
roymondchen committed Feb 6, 2023
1 parent 0491487 commit b9d4e8c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/utils/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import dayjs from 'dayjs';
import utc from 'dayjs/plugin/utc';

import type { MNode } from '@tmagic/schema';
import type { MComponent, MNode } from '@tmagic/schema';
import { NodeType } from '@tmagic/schema';

export * from './dom';
Expand Down Expand Up @@ -126,9 +126,9 @@ export const getUrlParam = (param: string, url?: string) => {
return '';
};

export const isPop = (node: MNode): boolean => Boolean(node.type?.toLowerCase().endsWith('pop'));
export const isPop = (node: MComponent | null): boolean => Boolean(node?.type?.toLowerCase().endsWith('pop'));

export const isPage = (node: MNode | undefined): boolean => {
export const isPage = (node?: MComponent | null): boolean => {
if (!node) return false;
return Boolean(node.type?.toLowerCase() === NodeType.PAGE);
};
Expand Down

0 comments on commit b9d4e8c

Please sign in to comment.