diff options
Diffstat (limited to 'packages/integrations/sitemap/src/utils/is-object-empty.ts')
-rw-r--r-- | packages/integrations/sitemap/src/utils/is-object-empty.ts | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/packages/integrations/sitemap/src/utils/is-object-empty.ts b/packages/integrations/sitemap/src/utils/is-object-empty.ts new file mode 100644 index 000000000..0d6181069 --- /dev/null +++ b/packages/integrations/sitemap/src/utils/is-object-empty.ts @@ -0,0 +1,10 @@ +// @internal +export const isObjectEmpty = (o: any) => { + if (!o) { + return true; + } + if (Array.isArray(o)) { + return o.length === 0; + } + return Object.keys(o).length === 0 && Object.getPrototypeOf(o) === Object.prototype; +}; |