bendrucker/snakecase-keys

Wrong type for array with undefined values

Opened this issue · 0 comments

When I want to transform an array with undefined values all valid objects in the union are getting ignored.

Live Example: https://codesandbox.io/p/sandbox/snakecasekeys-bug-tmtn42

The following code produces an error on nested_prop.

const obj = {
  propName1: [
    {
      nestedProp: "val",
    },
    undefined,
  ],
};

const result = snakecaseKeys(obj, { deep: true });

console.log(result.prop_name1.map((item) => item?.nested_prop));