Skip to content

Commit

Permalink
check for null objects
Browse files Browse the repository at this point in the history
  • Loading branch information
hadijahkyampeire committed Jun 17, 2024
1 parent 40c48df commit 2112152
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/esm-commons-lib/src/utils/schema-manipulation.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
export function extractSchemaValues(schema) {
const result = {};
function traverse(obj) {
Object.entries(obj).forEach(([key, value]) => {
if (obj === null || obj === undefined || typeof obj !== 'object') {
return;
}
Object.entries(obj)?.forEach(([key, value]) => {
if (value !== undefined && value !== null) {
if (typeof value === 'object' && !Array.isArray(value)) {
traverse(value);
Expand Down

0 comments on commit 2112152

Please sign in to comment.