Skip to content

Conversation

thatnerdjosh
Copy link

No description provided.

for(var i in result) {
if(result.hasOwnProperty(i)) {
if(typeof result[i] === 'undefined' || result[i] === '') delete result[i];
if(typeof result[i] === 'undefined' || result[i] === '' || Object.keys(result[i]).length == 0 && result[i].constructor == Object) delete result[i];
Copy link

@dexif dexif Apr 28, 2017

Choose a reason for hiding this comment

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

Wrong logic. It's should be...
Oh... And you should check if result[i] == null

if(typeof result[i] === 'undefined' || result[i] === '' || (result[i] !== null && Object.keys(result[i]).length == 0 && result[i].constructor == Object)) delete result[i];

btsimonh pushed a commit to btsimonh/json-editor that referenced this pull request May 26, 2021
btsimonh pushed a commit to btsimonh/json-editor that referenced this pull request May 26, 2021
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.

2 participants