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

Add option to exclude undefined values when encoding objects #71 #97

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

simonjeesam
Copy link

No description provided.

@@ -31,6 +31,7 @@ function getWriteType(options) {
var bin = binarraybuffer ? bin_arraybuffer : bin_buffer;
var usemap = HAS_MAP && options && options.usemap;
var map = usemap ? map_to_map : obj_to_map;
var strip_undef = options && options.strip_undef;
Copy link

@AArnott AArnott Jun 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about calling it omit_undefined_properties?
undef is needlessly terse, and by spelling out the "properties" part, we're clear that it doesn't remove them from array elements.

Suggested change
var strip_undef = options && options.strip_undef;
var strip_undef = options && options.omit_undefined_properties;

@ixis-doug
Copy link

@AArnott can you review this PR and state what changes are required to get this merged? The original contributor may have abandoned the PR, but this would be a useful addition to the library IMO, and if the only outstanding issue is to rename the option, that should be easy to get over the line.

Copy link

@AArnott AArnott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The functional change looks adequate. It just could use a rename of the option.

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

3 participants