mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-26 07:58:34 +02:00
turn getCommandsThatCount into a map
This commit is contained in:
parent
54414925fa
commit
9821df3bb7
3 changed files with 21 additions and 18 deletions
|
@ -6411,9 +6411,10 @@ var Level = Sandbox.extend({
|
|||
}
|
||||
|
||||
var matched = false;
|
||||
_.each(GitCommands.commands.getCommandsThatCount(), function(name) {
|
||||
var regex = GitCommands.commands.getRegex(name);
|
||||
matched = matched || regex.test(command.get('rawStr'));
|
||||
_.each(GitCommands.commands.getCommandsThatCount(), function(map) {
|
||||
_.each(map, function(regex) {
|
||||
matched = matched || regex.test(command.get('rawStr'));
|
||||
});
|
||||
});
|
||||
if (matched) {
|
||||
this.gitCommandsIssued.push(command.get('rawStr'));
|
||||
|
@ -9929,12 +9930,12 @@ var commands = {
|
|||
* which commands count for the git golf game
|
||||
*/
|
||||
getCommandsThatCount: function() {
|
||||
var counted = [];
|
||||
this.loop(function(config, name) {
|
||||
var counted = {'git': {}};
|
||||
this.loop(function(config, name, vcs) {
|
||||
if (config.dontCountForGolf) {
|
||||
return;
|
||||
}
|
||||
counted.push(name);
|
||||
counted[vcs][name] = config.regex;
|
||||
});
|
||||
return counted;
|
||||
},
|
||||
|
@ -23824,12 +23825,12 @@ var commands = {
|
|||
* which commands count for the git golf game
|
||||
*/
|
||||
getCommandsThatCount: function() {
|
||||
var counted = [];
|
||||
this.loop(function(config, name) {
|
||||
var counted = {'git': {}};
|
||||
this.loop(function(config, name, vcs) {
|
||||
if (config.dontCountForGolf) {
|
||||
return;
|
||||
}
|
||||
counted.push(name);
|
||||
counted[vcs][name] = config.regex;
|
||||
});
|
||||
return counted;
|
||||
},
|
||||
|
@ -28655,9 +28656,10 @@ var Level = Sandbox.extend({
|
|||
}
|
||||
|
||||
var matched = false;
|
||||
_.each(GitCommands.commands.getCommandsThatCount(), function(name) {
|
||||
var regex = GitCommands.commands.getRegex(name);
|
||||
matched = matched || regex.test(command.get('rawStr'));
|
||||
_.each(GitCommands.commands.getCommandsThatCount(), function(map) {
|
||||
_.each(map, function(regex) {
|
||||
matched = matched || regex.test(command.get('rawStr'));
|
||||
});
|
||||
});
|
||||
if (matched) {
|
||||
this.gitCommandsIssued.push(command.get('rawStr'));
|
||||
|
|
|
@ -62,12 +62,12 @@ var commands = {
|
|||
* which commands count for the git golf game
|
||||
*/
|
||||
getCommandsThatCount: function() {
|
||||
var counted = [];
|
||||
this.loop(function(config, name) {
|
||||
var counted = {'git': {}};
|
||||
this.loop(function(config, name, vcs) {
|
||||
if (config.dontCountForGolf) {
|
||||
return;
|
||||
}
|
||||
counted.push(name);
|
||||
counted[vcs][name] = config.regex;
|
||||
});
|
||||
return counted;
|
||||
},
|
||||
|
|
|
@ -309,9 +309,10 @@ var Level = Sandbox.extend({
|
|||
}
|
||||
|
||||
var matched = false;
|
||||
_.each(GitCommands.commands.getCommandsThatCount(), function(name) {
|
||||
var regex = GitCommands.commands.getRegex(name);
|
||||
matched = matched || regex.test(command.get('rawStr'));
|
||||
_.each(GitCommands.commands.getCommandsThatCount(), function(map) {
|
||||
_.each(map, function(regex) {
|
||||
matched = matched || regex.test(command.get('rawStr'));
|
||||
});
|
||||
});
|
||||
if (matched) {
|
||||
this.gitCommandsIssued.push(command.get('rawStr'));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue