Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

ref: Delete empty properties before sending event to the server #407

Merged
merged 1 commit into from
Dec 11, 2017

Conversation

kamilogorek
Copy link
Contributor

Fixes #406

lib/client.js Outdated
}
// Cleanup empty properties before sending them to the server
Object.keys(kwargs).forEach(function(key) {
if (typeof kwargs[key] === 'undefined' || kwargs[key] === '') {

Choose a reason for hiding this comment

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

Why not just use kwargs[key] === undefined, the typeof check is only really needed for globals.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm just used to use this check instead. It doesn't change any performance characteristics, as it's just one lookup. Although I think we should include null here as well, so we should end up with kwargs[key] == null || kwargs[key] === '' instead (allowing for 0 to be passed).

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

Successfully merging this pull request may close these issues.

3 participants