Add flag to exclude instance properties from enumeration#724
Merged
dxg merged 1 commit intodresende:masterfrom May 9, 2016
Merged
Add flag to exclude instance properties from enumeration#724dxg merged 1 commit intodresende:masterfrom
dxg merged 1 commit intodresende:masterfrom
Conversation
lib/Instance.js
Outdated
| prop && prop.hasOwnProperty && | ||
| prop.hasOwnProperty('enumerable') && | ||
| !prop.enumerable | ||
| ); |
Collaborator
There was a problem hiding this comment.
I really like this idea, but it would be better to handle this at the source as we do with required so that every property has enumerable set.
Also, this PR needs some tests.
Contributor
Author
There was a problem hiding this comment.
Nice, I'll move this code this week. I'll also add some tests (I tried to run them on my macbook but had some issues. I'll investigate further...)
| opts.changes.push(key); | ||
| } | ||
| }, | ||
| enumerable: true |
Contributor
Author
There was a problem hiding this comment.
prop may be undefined when key is value on a 'hasMany' relationship.
Contributor
Author
|
@dxg Updated - I was trying to find where the |
Collaborator
|
👍 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We would like to be able to have certain properties not get serialized by
JSON.stringify. Eg:Currently we have a
serialize()method declared on theuserdefinition which only includes properties we want. We callres.send(user.serialize())but this isn't recursive, is quite unclean, and can potentially allow us to 'leak' secret properties if we are forgetful to call.serialize().When this merges I will update the Wiki accordingly.