Skip to content

Commit

Permalink
Add flag to exclude instance properties from enumeration
Browse files Browse the repository at this point in the history
  • Loading branch information
flacnut committed May 6, 2016
1 parent 4d3ad7d commit 07f0f1a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/Instance.js
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,14 @@ function Instance(Model, opts) {
var addInstanceProperty = function (key) {
var defaultValue = null;
var prop = Model.allProperties[key];
var isEnumerable;

// Defaults to true unless explicitly set to false
isEnumerable = !(
prop && prop.hasOwnProperty &&
prop.hasOwnProperty('enumerable') &&
!prop.enumerable
);

// This code was first added, and then commented out in a later commit.
// Its presence doesn't affect tests, so I'm just gonna log if it ever gets called.
Expand Down Expand Up @@ -519,7 +527,7 @@ function Instance(Model, opts) {
opts.changes.push(key);
}
},
enumerable: true
enumerable: isEnumerable
});
};
var addInstanceExtraProperty = function (key) {
Expand Down

0 comments on commit 07f0f1a

Please sign in to comment.