Skip to content

Commit

Permalink
feat: Compare value can be custom function
Browse files Browse the repository at this point in the history
  • Loading branch information
mkg20001 committed Aug 4, 2018
1 parent 4ced8a4 commit 99af52f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/match.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = (parsedAddr, connState) => {

for (const key in cur.conditions) {
const cond = cur.conditions[key]
const compareFnc = types[cond.type][cond.compare]
const compareFnc = typeof cond.value === 'function' ? cond.value : types[cond.type][cond.compare]

if (!compareFnc(connState[i][1][key], cond.value)) { // can't match, direct comparison failed
return 0
Expand Down

0 comments on commit 99af52f

Please sign in to comment.