Skip to content

Commit

Permalink
Move two variable definitions to combine them with their declarations.
Browse files Browse the repository at this point in the history
  • Loading branch information
Max Schaefer committed Aug 16, 2017
1 parent 48b835c commit 8950d44
Showing 1 changed file with 33 additions and 35 deletions.
68 changes: 33 additions & 35 deletions client/galaxy/scripts/mvc/workflow/workflow-terminals.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,39 @@ define(['mvc/workflow/workflow-globals'], function( Globals ) {
this.rank = collectionType.split(":").length;
}

var ANY_COLLECTION_TYPE_DESCRIPTION, NULL_COLLECTION_TYPE_DESCRIPTION;
var NULL_COLLECTION_TYPE_DESCRIPTION = {
isCollection: false,
canMatch: function( other ) { return false; },
canMapOver: function( other ) {
return false;
},
toString: function() {
return "NullCollectionType[]";
},
append: function( otherCollectionType ) {
return otherCollectionType;
},
equal: function( other ) {
return other === this;
}
};

var ANY_COLLECTION_TYPE_DESCRIPTION = {
isCollection: true,
canMatch: function( other ) { return NULL_COLLECTION_TYPE_DESCRIPTION !== other; },
canMapOver: function( other ) {
return false;
},
toString: function() {
return "AnyCollectionType[]";
},
append: function( otherCollectionType ) {
throw "Cannot append to ANY_COLLECTION_TYPE_DESCRIPTION";
},
equal: function( other ) {
return other === this;
}
};

$.extend( CollectionTypeDescription.prototype, {
append: function( otherCollectionTypeDescription ) {
Expand Down Expand Up @@ -56,40 +88,6 @@ define(['mvc/workflow/workflow-globals'], function( Globals ) {
}
} );

NULL_COLLECTION_TYPE_DESCRIPTION = {
isCollection: false,
canMatch: function( other ) { return false; },
canMapOver: function( other ) {
return false;
},
toString: function() {
return "NullCollectionType[]";
},
append: function( otherCollectionType ) {
return otherCollectionType;
},
equal: function( other ) {
return other === this;
}
};

ANY_COLLECTION_TYPE_DESCRIPTION = {
isCollection: true,
canMatch: function( other ) { return NULL_COLLECTION_TYPE_DESCRIPTION !== other; },
canMapOver: function( other ) {
return false;
},
toString: function() {
return "AnyCollectionType[]";
},
append: function( otherCollectionType ) {
throw "Cannot append to ANY_COLLECTION_TYPE_DESCRIPTION";
},
equal: function( other ) {
return other === this;
}
};

var TerminalMapping = Backbone.Model.extend( {
initialize: function( attr ) {
this.mapOver = attr.mapOver || NULL_COLLECTION_TYPE_DESCRIPTION;
Expand Down

0 comments on commit 8950d44

Please sign in to comment.