Skip to content

Conversation

@markbjerke
Copy link

This is a merge of three other pull requests. I based the collect feature off of this branch.
#176 exposed ParseRules
#175 refactored createRule
#180 expose match class

@markbjerke markbjerke mentioned this pull request Feb 9, 2016
Copy link
Collaborator

@DevSide DevSide left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks !

function findIndex(coll, item) {
var target = -1;
if( 'function' === typeof item ) {
coll.some(function(e, i) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

forEach

});
}
else {
coll.some(function(e, i) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here too

this.name = name;
this.pattern = pattern;
this.cb = cb;
this.noLoop = options.noLoop;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not yet 😄

}
return rules;
var rules = [], scope, patterns, isComposite;
function processConditions(conditions, scope) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can remove processConditions which is almost all createRule

merged = [],
fnMerge = _mergePatterns(merged),
isRules = extd.every(conditions, function (cond) {return isArray(cond);}),
condition, rules, patterns;
Copy link
Collaborator

@DevSide DevSide Oct 4, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then remove rules and patterns, they are declared upper

});
}
return rules;
var rules = [], scope, patterns, isComposite;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isComposite is not used

if(parts && parts.length ) {
rule.push('collect');
rule.push(parts[2], parts[1]);
constraints = parts[3].trim();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use replace(/^\s*|\s*$/g, "") like below, it's safer for tab char

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants