-
Notifications
You must be signed in to change notification settings - Fork 181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ce collect dependencies #183
base: master
Are you sure you want to change the base?
Conversation
added findIndex to lib/extends.js
There was a problem hiding this 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) { |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here too
@@ -227,6 +237,7 @@ var Rule = declare({ | |||
this.name = name; | |||
this.pattern = pattern; | |||
this.cb = cb; | |||
this.noLoop = options.noLoop; |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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
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