@tmagic/utils 1.7.14-beta.2 → 1.7.14-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.7.14-beta.2",
2
+ "version": "1.7.14-beta.3",
3
3
  "name": "@tmagic/utils",
4
4
  "type": "module",
5
5
  "sideEffects": false,
@@ -35,7 +35,7 @@
35
35
  },
36
36
  "peerDependencies": {
37
37
  "typescript": "^6.0.3",
38
- "@tmagic/schema": "1.7.14-beta.2"
38
+ "@tmagic/schema": "1.7.14-beta.3"
39
39
  },
40
40
  "peerDependenciesMeta": {
41
41
  "typescript": {
package/src/index.ts CHANGED
@@ -262,14 +262,15 @@ export const delQueStr = (url: string, ref: string[] | string) => {
262
262
 
263
263
  export const isObject = (obj: any) => Object.prototype.toString.call(obj) === '[object Object]';
264
264
 
265
- export const isPop = (node: MComponent | null): boolean => Boolean(node?.type?.toLowerCase().endsWith('pop'));
265
+ export const isPop = (node: Pick<MComponent, 'type'> | null): boolean =>
266
+ Boolean(node?.type?.toLowerCase().endsWith('pop'));
266
267
 
267
- export const isPage = (node?: MComponent | null): boolean => {
268
+ export const isPage = (node?: Pick<MComponent, 'type'> | null): boolean => {
268
269
  if (!node) return false;
269
270
  return Boolean(node.type?.toLowerCase() === NodeType.PAGE);
270
271
  };
271
272
 
272
- export const isPageFragment = (node?: MComponent | null): boolean => {
273
+ export const isPageFragment = (node?: Pick<MComponent, 'type'> | null): boolean => {
273
274
  if (!node) return false;
274
275
  return Boolean(node.type?.toLowerCase() === NodeType.PAGE_FRAGMENT);
275
276
  };
package/types/index.d.ts CHANGED
@@ -70,9 +70,9 @@ declare const setUrlParam: (name: string, value: string, url?: string) => string
70
70
  declare const getSearchObj: (search?: string) => Record<string, string>;
71
71
  declare const delQueStr: (url: string, ref: string[] | string) => string;
72
72
  declare const isObject: (obj: any) => boolean;
73
- declare const isPop: (node: MComponent | null) => boolean;
74
- declare const isPage: (node?: MComponent | null) => boolean;
75
- declare const isPageFragment: (node?: MComponent | null) => boolean;
73
+ declare const isPop: (node: Pick<MComponent, "type"> | null) => boolean;
74
+ declare const isPage: (node?: Pick<MComponent, "type"> | null) => boolean;
75
+ declare const isPageFragment: (node?: Pick<MComponent, "type"> | null) => boolean;
76
76
  declare const isNumber: (value: any) => boolean;
77
77
  declare const getHost: (targetUrl: string) => string | undefined;
78
78
  declare const isSameDomain: (targetUrl?: string, source?: string) => boolean;