-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
replace var with const #9394
replace var with const #9394
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, other than the arrow function changes, which have numerous issues. Can you please undo those?
docs/guide.pug
Outdated
animalSchema.methods.findSimilarTypes = function(cb) { | ||
return mongoose.model('Animal').find({ type: this.type }, cb); | ||
}; | ||
animalSchema.methods.findSimilarTypes = cb => ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change doesn't work because the method uses this
, which arrow functions mess up.
docs/guide.pug
Outdated
animalSchema.statics.findByName = function(name) { | ||
return this.find({ name: new RegExp(name, 'i') }); | ||
}; | ||
animalSchema.statics.findByName = name => ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change doesn't work because the static function uses this
, which arrow functions mess up.
docs/guide.pug
Outdated
animalSchema.static('findByBreed', function(breed) { | ||
return this.find({ breed }); | ||
}); | ||
animalSchema.static('findByBreed', breed => this.find({ breed }) ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change doesn't work because the static function uses this
, which arrow functions mess up.
docs/guide.pug
Outdated
@@ -325,7 +323,7 @@ block content | |||
define a `fullName` property that won't get persisted to MongoDB. | |||
|
|||
```javascript | |||
personSchema.virtual('fullName').get(function () { | |||
personSchema.virtual('fullName').get(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change doesn't work because the virtual getter uses this
, which arrow functions mess up.
Oh! Sorry. That's a major issue. Will remove those. Thanks |
Thanks for submitting a pull request! Please provide enough information so that others can review your pull request. The two fields below are mandatory.
If you're making a change to documentation, do not modify a
.html
file directly. Instead find the corresponding.pug
file or test case in thetest/docs
directory.Summary
Examples