mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-28 00:40:07 +02:00
Replace '_.map' to 'Array.prototype.map'
This commit is contained in:
parent
0134bf9870
commit
7af2db3da5
5 changed files with 11 additions and 11 deletions
|
@ -190,7 +190,7 @@ var commandConfig = {
|
||||||
|
|
||||||
var set = Graph.getUpstreamSet(engine, 'HEAD');
|
var set = Graph.getUpstreamSet(engine, 'HEAD');
|
||||||
// first resolve all the refs (as an error check)
|
// first resolve all the refs (as an error check)
|
||||||
var toCherrypick = _.map(generalArgs, function(arg) {
|
var toCherrypick = generalArgs.map(function (arg) {
|
||||||
var commit = engine.getCommitFromRef(arg);
|
var commit = engine.getCommitFromRef(arg);
|
||||||
// and check that its not upstream
|
// and check that its not upstream
|
||||||
if (set[commit.get('id')]) {
|
if (set[commit.get('id')]) {
|
||||||
|
|
|
@ -857,7 +857,7 @@ GitEngine.prototype.makeCommit = function(parents, id, options) {
|
||||||
|
|
||||||
GitEngine.prototype.revert = function(whichCommits) {
|
GitEngine.prototype.revert = function(whichCommits) {
|
||||||
// resolve the commits we will rebase
|
// resolve the commits we will rebase
|
||||||
var toRevert = _.map(whichCommits, function(stringRef) {
|
var toRevert = whichCommits.map(function(stringRef) {
|
||||||
return this.getCommitFromRef(stringRef);
|
return this.getCommitFromRef(stringRef);
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
|
@ -1138,7 +1138,7 @@ GitEngine.prototype.push = function(options) {
|
||||||
var makeCommit = function(id, parentIDs) {
|
var makeCommit = function(id, parentIDs) {
|
||||||
// need to get the parents first. since we order by depth, we know
|
// need to get the parents first. since we order by depth, we know
|
||||||
// the dependencies are there already
|
// the dependencies are there already
|
||||||
var parents = _.map(parentIDs, function(parentID) {
|
var parents = parentIDs.map(function(parentID) {
|
||||||
return this.origin.refs[parentID];
|
return this.origin.refs[parentID];
|
||||||
}, this);
|
}, this);
|
||||||
return this.origin.makeCommit(parents, id);
|
return this.origin.makeCommit(parents, id);
|
||||||
|
@ -1246,7 +1246,7 @@ GitEngine.prototype.fetch = function(options) {
|
||||||
}
|
}
|
||||||
// get all remote branches and specify the dest / source pairs
|
// get all remote branches and specify the dest / source pairs
|
||||||
var allBranchesOnRemote = this.origin.branchCollection.toArray();
|
var allBranchesOnRemote = this.origin.branchCollection.toArray();
|
||||||
var sourceDestPairs = _.map(allBranchesOnRemote, function(branch) {
|
var sourceDestPairs = allBranchesOnRemote.map(function(branch) {
|
||||||
var branchName = branch.get('id');
|
var branchName = branch.get('id');
|
||||||
didMakeBranch = didMakeBranch || this.makeRemoteBranchIfNeeded(branchName);
|
didMakeBranch = didMakeBranch || this.makeRemoteBranchIfNeeded(branchName);
|
||||||
|
|
||||||
|
@ -1312,7 +1312,7 @@ GitEngine.prototype.fetchCore = function(sourceDestPairs, options) {
|
||||||
var makeCommit = function(id, parentIDs) {
|
var makeCommit = function(id, parentIDs) {
|
||||||
// need to get the parents first. since we order by depth, we know
|
// need to get the parents first. since we order by depth, we know
|
||||||
// the dependencies are there already
|
// the dependencies are there already
|
||||||
var parents = _.map(parentIDs, function(parentID) {
|
var parents = parentIDs.map(function(parentID) {
|
||||||
return this.refs[parentID];
|
return this.refs[parentID];
|
||||||
}, this);
|
}, this);
|
||||||
return this.makeCommit(parents, id);
|
return this.makeCommit(parents, id);
|
||||||
|
@ -1738,7 +1738,7 @@ GitEngine.prototype.updateBranchesFromSet = function(commitSet) {
|
||||||
});
|
});
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
var branchList = _.map(branchesToUpdate, function(val, id) {
|
var branchList = branchesToUpdate.map(function(val, id) {
|
||||||
return id;
|
return id;
|
||||||
});
|
});
|
||||||
return this.updateBranchesForHg(branchList);
|
return this.updateBranchesForHg(branchList);
|
||||||
|
@ -2340,7 +2340,7 @@ GitEngine.prototype.filterRebaseCommits = function(
|
||||||
|
|
||||||
GitEngine.prototype.getRebasePreserveMergesParents = function(oldCommit) {
|
GitEngine.prototype.getRebasePreserveMergesParents = function(oldCommit) {
|
||||||
var oldParents = oldCommit.get('parents');
|
var oldParents = oldCommit.get('parents');
|
||||||
return _.map(oldParents, function(parent) {
|
return oldParents.map(function(parent) {
|
||||||
var oldID = parent.get('id');
|
var oldID = parent.get('id');
|
||||||
var newID = this.getMostRecentBumpedID(oldID);
|
var newID = this.getMostRecentBumpedID(oldID);
|
||||||
return this.refs[newID];
|
return this.refs[newID];
|
||||||
|
|
|
@ -78,7 +78,7 @@ var Command = Backbone.Model.extend({
|
||||||
var generalArgs = this.getGeneralArgs();
|
var generalArgs = this.getGeneralArgs();
|
||||||
var options = this.getOptionsMap();
|
var options = this.getOptionsMap();
|
||||||
|
|
||||||
generalArgs = _.map(generalArgs, function(arg) {
|
generalArgs = generalArgs.map(function(arg) {
|
||||||
return this.replaceDotWithHead(arg);
|
return this.replaceDotWithHead(arg);
|
||||||
}, this);
|
}, this);
|
||||||
var newMap = {};
|
var newMap = {};
|
||||||
|
|
|
@ -83,8 +83,8 @@ var GitDemonstrationView = ContainedBase.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
checkScroll: function() {
|
checkScroll: function() {
|
||||||
var children = this.$('div.demonstrationText').children();
|
var children = this.$('div.demonstrationText').children().toArray();
|
||||||
var heights = _.map(children, function(child) { return child.clientHeight; });
|
var heights = children.map(function(child) { return child.clientHeight; });
|
||||||
var totalHeight = _.reduce(heights, function(a, b) { return a + b; });
|
var totalHeight = _.reduce(heights, function(a, b) { return a + b; });
|
||||||
if (totalHeight < this.$('div.demonstrationText').height()) {
|
if (totalHeight < this.$('div.demonstrationText').height()) {
|
||||||
this.$('div.demonstrationText').addClass('noLongText');
|
this.$('div.demonstrationText').addClass('noLongText');
|
||||||
|
|
|
@ -211,7 +211,7 @@ var LevelDropdownView = ContainedBase.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
getTabIndex: function() {
|
getTabIndex: function() {
|
||||||
var ids = _.map(this.JSON.tabs, function(tab) {
|
var ids = this.JSON.tabs.map(function(tab) {
|
||||||
return tab.id;
|
return tab.id;
|
||||||
});
|
});
|
||||||
return ids.indexOf(this.JSON.selectedTab);
|
return ids.indexOf(this.JSON.selectedTab);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue