Skip to content
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

How to set undefined by dot.set #84

Open
winjeysong opened this issue Jun 3, 2024 · 0 comments
Open

How to set undefined by dot.set #84

winjeysong opened this issue Jun 3, 2024 · 0 comments

Comments

@winjeysong
Copy link

Thanks for your big work on maintaining this library. It helps me a log!

But now, I faced a problem.

// Do not operate if the value is undefined.
if (typeof val === 'undefined') {
return obj
}

Due to the code above, I can't set undefined like that:

const o = { foo: { bar: 'baz' } };
dot.set('foo.bar', undefined, o); // not work

So is there a way to set undefined by dot.set ? Or just remove the code I mentioned above, and library users can do what they want.

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

No branches or pull requests

1 participant