Skip to content

Commit

Permalink
feat: new Function: isWindow & update isObject
Browse files Browse the repository at this point in the history
  • Loading branch information
GreatAuk committed Aug 24, 2023
1 parent 46633ad commit 7bfb625
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/share/src/is.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ export const isPrimitive = (val: unknown): val is string | number | boolean | sy
export const isNil = (val: unknown): val is null | undefined => val === null || val === undefined

export const isObject = (val: unknown): val is Record<any, any> =>
val !== null && typeof val === 'object'
val !== null && toTypeString(val) === 'Object'

export const isWindow = (val: unknown): boolean => typeof window !== 'undefined' && toTypeString(val) === 'Window'

export const isIntegerKey = (key: unknown) =>
isString(key)
&& key !== 'NaN'
Expand Down

0 comments on commit 7bfb625

Please sign in to comment.