fix: install clean-deep
This commit is contained in:
15
server/routers/utils/index.ts
Normal file
15
server/routers/utils/index.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import cleaner from "clean-deep"
|
||||
|
||||
/**
|
||||
* Function to remove empty objects from a fetched content type.
|
||||
* Used since Contentstack returns empty objects for all non
|
||||
* queried in modular blocks.
|
||||
*/
|
||||
export function removeEmptyObjects<T>(obj: T) {
|
||||
return cleaner(obj, {
|
||||
emptyArrays: false,
|
||||
emptyStrings: false,
|
||||
nullValues: false,
|
||||
undefinedValues: false,
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user