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

fix: renamed attribute should remain enumerable #133

Merged
merged 2 commits into from
Jul 9, 2021

Conversation

cyjake
Copy link
Owner

@cyjake cyjake commented Jul 8, 2021

even if there is getter method with same name. Also added Model.Instance in sequelize adapter

@cyjake cyjake force-pushed the fix-rename-attribute branch 2 times, most recently from 9b6630b to f630bf0 Compare July 8, 2021 10:53
@@ -126,6 +126,10 @@ module.exports = Bone => {
return true;
}

static get Instance() {
return this;
}
Copy link
Owner Author

Choose a reason for hiding this comment

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

added Model.Instance alias

]);
User.renameAttribute('foo', 'bar');
assert.ok(Object.getOwnPropertyDescriptor(User.prototype, 'bar').enumerable);
});
Copy link
Owner Author

Choose a reason for hiding this comment

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

It's expected that attributes should always present in toJSON() or toObject() results. Make renamed attribute enumerable as well.

cyjake and others added 2 commits July 9, 2021 05:03
even if there is getter method with same name
Co-authored-by: JimmyDaddy <heyjimmygo@gmail.com>
@cyjake cyjake force-pushed the fix-rename-attribute branch from 91fb779 to e161ec3 Compare July 8, 2021 21:04
@JimmyDaddy JimmyDaddy merged commit 7dbff39 into master Jul 9, 2021
@cyjake cyjake deleted the fix-rename-attribute branch July 15, 2021 18:21
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