Skip to content
This repository was archived by the owner on Jan 6, 2021. It is now read-only.

Commit 3c6cef3

Browse files
committed
Changed ref compare algorithm
1 parent cdb6d01 commit 3c6cef3

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

app.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -112,19 +112,19 @@ http.createServer(function(request, response) {
112112
}
113113
spawn_options.cwd = cfg.path;
114114

115+
Object.keys(cfg.refs).some(function (k) {
116+
return bodyObj.ref.match(cfg.refs[k]);
117+
});
118+
115119
if(cfg.refs){
116120
var refsType = typeof cfg.refs;
117121
if(['string', 'object'].indexOf(refsType)){
118122
if(refsType == 'string') cfg.refs = [cfg.refs];
119123

120-
var refNotMatch = true;
121-
for(var key in cfg.refs){
122-
if(bodyObj.ref.match(cfg.refs[key])) {
123-
refNotMatch = false;
124-
break;
125-
}
126-
}
127-
if(refNotMatch) return log('No refs match. Aborting.', request.url + '.info');
124+
var suitableRef = Object.keys(cfg.refs).some(function (k) {
125+
return bodyObj.ref.match(cfg.refs[k]);
126+
});
127+
if(!suitableRef) return log('Ref does not fit. Aborting.', request.url + '.info');
128128
}
129129
}
130130

0 commit comments

Comments
 (0)