fix(medusa-react): Fix production.min.js causing invalid hook usage error in CJS environments (#3144)
This commit is contained in:
committed by
GitHub
parent
b242e22326
commit
4fbf6b7ad3
11
packages/medusa-react/src/utils/index.ts
Normal file
11
packages/medusa-react/src/utils/index.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
export const isObject = (input: any) => input instanceof Object
|
||||
export const isArray = (input: any) => Array.isArray(input)
|
||||
export const isEmpty = (input: any) => {
|
||||
return (
|
||||
input === null ||
|
||||
input === undefined ||
|
||||
(isObject(input) && Object.keys(input).length === 0) ||
|
||||
(isArray(input) && (input as any[]).length === 0) ||
|
||||
(typeof input === "string" && input.trim().length === 0)
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user