Prefer ES5 methods over underscore utilities

Since 07cc454 (ie the switch to Meteor 1.2) we includes the `es5-shim`
polyfill to support methods like `Array.prototype.forEach` in a
consistent way across all supported browsers (IE8+).

MDG recently released a blog post recommending the use of these native
methods instead of underscore [0]. We know follow this recommendation.

This commit also favor some ES6 features (argument defaults,
destructing assignment) in places where we didn’t use them.

[0]: http://info.meteor.com/blog/es2015-get-started
This commit is contained in:
Maxime Quandalle 2015-10-22 04:02:12 +02:00
parent c6b12dc5ad
commit aa974aa54a
14 changed files with 33 additions and 31 deletions

View file

@ -95,7 +95,7 @@ Filter = {
return {};
const filterSelector = {};
_.forEach(this._fields, (fieldName) => {
this._fields.forEach((fieldName) => {
const filter = this[fieldName];
if (filter._isActive())
filterSelector[fieldName] = filter._getMongoSelector();
@ -116,7 +116,7 @@ Filter = {
},
reset() {
_.forEach(this._fields, (fieldName) => {
this._fields.forEach((fieldName) => {
const filter = this[fieldName];
filter.reset();
});