Skip to content

📝 improve flatten function with object type check #12306

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 7, 2024

Conversation

bluebill1049
Copy link
Member

No description provided.

@bluebill1049 bluebill1049 changed the title improve flatten function with object type check 📝 improve flatten function with object type check Oct 7, 2024
Copy link
Contributor

github-actions bot commented Oct 7, 2024

Size Change: -6 B (-0.03%)

Total Size: 21.2 kB

Filename Size Change
dist/index.cjs.js 10.5 kB -3 B (-0.03%)
dist/index.umd.js 10.6 kB -3 B (-0.03%)

compressed-size-action

@bluebill1049 bluebill1049 merged commit cb61669 into master Oct 7, 2024
6 checks passed
@bluebill1049 bluebill1049 deleted the improve-flatten branch October 7, 2024 12:06
@cakrabirawa
Copy link

Hallo,
I have a error

var Controller = (props) => props.render(useController(props));
var flatten = (obj) => {
const output = {};
for (const key of Object.keys(obj)) {
if (isObjectType(obj[key])) {
const nested = flatten(obj[key]);
for (const nestedKey of Object.keys(nested)) {
output[${key}.${nestedKey}] = nested[nestedKey];
}
} else {
output[key] = obj[key];
}
}
return output;
};

Uncaught (in promise) TypeError: Cannot convert undefined or null to object
at Function.keys ()
at flatten (react-hook-form.js?v=3a4a2705:316:28)
at flatten (react-hook-form.js?v=3a4a2705:318:22)
at react-hook-form.js?v=3a4a2705:343:33
at react-hook-form.js?v=3a4a2705:1675:15
at async submit (react-hook-form.js?v=3a4a2705:336:5)

I use your

tag, before this version its ok..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants