Skip to content

Ce collect dependencies - #183

Open
markbjerke wants to merge 5 commits into
noolsjs:masterfrom
markbjerke:ce-collect-dependencies
Open

Ce collect dependencies#183
markbjerke wants to merge 5 commits into
noolsjs:masterfrom
markbjerke:ce-collect-dependencies

Conversation

@markbjerke

Copy link
Copy Markdown

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

@markbjerkemarkbjerke mentioned this pull request Feb 9, 2016

@DevSideDevSide left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks !

Comment threadlib/extended.js
function findIndex(coll, item) {
var target = -1;
if( 'function' === typeof item ) {
coll.some(function(e, i) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

forEach

Comment threadlib/extended.js
});
}
else {
coll.some(function(e, i) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

here too

Comment threadlib/rule.js
this.name = name;
this.pattern = pattern;
this.cb = cb;
this.noLoop = options.noLoop;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

not yet 😄

Comment threadlib/rule.js
}
return rules;
var rules = [], scope, patterns, isComposite;
function processConditions(conditions, scope) {

Copy link
Copy Markdown
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

Comment threadlib/rule.js
merged = [],
fnMerge = _mergePatterns(merged),
isRules = extd.every(conditions, function (cond) {return isArray(cond);}),
condition, rules, patterns;

@DevSideDevSideOct 4, 2016

Copy link
Copy Markdown
Collaborator

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

Comment threadlib/rule.js
});
}
return rules;
var rules = [], scope, patterns, isComposite;

Copy link
Copy Markdown
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
Copy Markdown
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 freeto 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

@markbjerke@DevSide