Skip to content

Commit

Permalink
Merge pull request #1 from vdh/patch-1
Browse files Browse the repository at this point in the history
Chaining support
  • Loading branch information
vdh committed Jan 27, 2016
2 parents 71a5623 + faac308 commit 1a2d0a2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,29 @@ export default class Criteria {
* @param {string} operator String '==', '!=', '>', '>=', '<', '<=', 'in', 'not_in', 'like', 'between'
* @param {string,number,Array} value Value(s) that match the operator.
* The only operators that allow array values are in|out|nin
* @returns {Criteria}
*/
appendExpression(fieldName, operator, value) {
this.criteria.push({
fieldName: fieldName,
operator: operator,
value: value
});
return this;
}

/**
* Appends a criteria object to the current criteria array.
* The criteria object may be a new Criteria class or any object with a toString method.
*
* @param {Criteria} criteria
* @returns {Criteria}
*/
appendCriteria(criteria) {
this.criteria.push({
criteria: criteria
});
return this;
}

/**
Expand Down Expand Up @@ -105,4 +109,4 @@ export default class Criteria {
return 'between';
}
}
}
}

0 comments on commit 1a2d0a2

Please sign in to comment.