mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-08-17 08:11:04 +02:00
Use 'Array.prototype.forEach' instead of '_.each' and '_.forEach'
This commit is contained in:
parent
d87fd095c0
commit
bd8009386d
19 changed files with 74 additions and 82 deletions
|
@ -3,7 +3,7 @@ var Backbone = require('backbone');
|
|||
|
||||
var VisBase = Backbone.Model.extend({
|
||||
removeKeys: function(keys) {
|
||||
_.each(keys, function(key) {
|
||||
keys.forEach(function(key) {
|
||||
if (this.get(key)) {
|
||||
this.get(key).remove();
|
||||
}
|
||||
|
@ -35,14 +35,14 @@ var VisBase = Backbone.Model.extend({
|
|||
},
|
||||
|
||||
setAttrBase: function(keys, attr, instant, speed, easing) {
|
||||
_.each(keys, function(key) {
|
||||
keys.forEach(function(key) {
|
||||
if (instant) {
|
||||
this.get(key).attr(attr[key]);
|
||||
} else {
|
||||
this.get(key).stop();
|
||||
this.get(key).animate(attr[key], speed, easing);
|
||||
// some keys don't support animating too, so set those instantly here
|
||||
_.forEach(this.getNonAnimateKeys(), function(nonAnimateKey) {
|
||||
this.getNonAnimateKeys().forEach(function(nonAnimateKey) {
|
||||
if (attr[key] && attr[key][nonAnimateKey] !== undefined) {
|
||||
this.get(key).attr(nonAnimateKey, attr[key][nonAnimateKey]);
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ var VisBase = Backbone.Model.extend({
|
|||
var attr = this.getAttributes();
|
||||
|
||||
// safely insert this attribute into all the keys we want
|
||||
_.each(keys.include, function(key) {
|
||||
keys.include.forEach(function(key) {
|
||||
attr[key] = Object.assign(
|
||||
{},
|
||||
attr[key],
|
||||
|
@ -78,7 +78,7 @@ var VisBase = Backbone.Model.extend({
|
|||
);
|
||||
});
|
||||
|
||||
_.each(keys.exclude, function(key) {
|
||||
keys.exclude.forEach(function(key) {
|
||||
delete attr[key];
|
||||
});
|
||||
|
||||
|
@ -87,4 +87,3 @@ var VisBase = Backbone.Model.extend({
|
|||
});
|
||||
|
||||
exports.VisBase = VisBase;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue