mirror of
https://github.com/wekan/wekan.git
synced 2025-12-17 07:50:12 +01:00
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:
parent
c6b12dc5ad
commit
aa974aa54a
14 changed files with 33 additions and 31 deletions
|
|
@ -119,12 +119,13 @@ MultiSelection = {
|
|||
}
|
||||
},
|
||||
|
||||
toggle(cardIds, options) {
|
||||
toggle(cardIds, options = {}) {
|
||||
cardIds = _.isString(cardIds) ? [cardIds] : cardIds;
|
||||
options = _.extend({
|
||||
options = {
|
||||
add: true,
|
||||
remove: true,
|
||||
}, options || {});
|
||||
...options,
|
||||
};
|
||||
|
||||
if (!this.isActive()) {
|
||||
this.reset();
|
||||
|
|
@ -133,7 +134,7 @@ MultiSelection = {
|
|||
|
||||
const selectedCards = this._selectedCards.get();
|
||||
|
||||
_.each(cardIds, (cardId) => {
|
||||
cardIds.forEach((cardId) => {
|
||||
const indexOfCard = selectedCards.indexOf(cardId);
|
||||
|
||||
if (options.remove && indexOfCard > -1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue