Is it possible to strip undefined properties on encoding?
See original GitHub issueIn the docs it says that both null
and undefined
will come through as null
on the other end. Is it possible to configure something to make undefined
properties to be removed completely during encoding?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:5 (1 by maintainers)
Top Results From Across the Web
How to remove undefined and null values from an object ...
You can simply chain _.omit() with _.isUndefined and _.isNull compositions, and get the result with lazy evaluation.
Read more >Strip unknown properties during encode · Issue #274 - GitHub
@ggoodman I'm working on this right now. My plan is to deprecate the type combinator in favour of a xxx (name to be...
Read more >Remove undefined values from an array in JavaScript
This post will discuss how to remove undefined values from an array in JavaScript. The solution should return a new array that excludes...
Read more >7 Tips to Handle undefined in JavaScript - Dmitri Pavlutin
The short answer is that JavaScript interpreter returns undefined when accessing a variable or object property that is not yet initialized.
Read more >3 Ways to Remove a Property from a JavaScript Object
Here the delete operator deletes property2 from the myObject . After the delete operator is completed, the object will no longer have the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I went ahead and tried a fix myself based on the work done by @brentd here.
Pull request here.
IMO it is a bug to have
undefined
encoded asnull
.undefined
should not be defined in the encoding. Just like with JSON:Yet with this lib: