Skip to content

Commit fc79246

Browse files
committed
Further optimize the comparison funcs
1 parent 9529c12 commit fc79246

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

optimizer.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ function checkIdioms (logic, engine, above) {
125125
if (typeof A === 'function' && typeof B === 'function') return (data, abv) => comparisonFunc(A(data, abv), B(data, abv))
126126
if (typeof A === 'function') return (data, abv) => comparisonFunc(A(data, abv), B)
127127
if (typeof B === 'function') return (data, abv) => comparisonFunc(A, B(data, abv))
128-
return () => comparisonFunc(A, B)
128+
return comparisonFunc(A, B)
129129
}
130130

131131
if (logic[comparison].length === 3) {
@@ -141,7 +141,7 @@ function checkIdioms (logic, engine, above) {
141141
if (typeof A === 'function') return (data, abv) => comparisonFunc(A(data, abv), B) && comparisonFunc(B, C)
142142
if (typeof B === 'function') return (data, abv) => comparisonFunc(A, (prev = B(data, abv))) && comparisonFunc(prev, C)
143143
if (typeof C === 'function') return (data, abv) => comparisonFunc(A, B) && comparisonFunc(B, C(data, abv))
144-
return () => comparisonFunc(A, B) && comparisonFunc(B, C)
144+
return comparisonFunc(A, B) && comparisonFunc(B, C)
145145
}
146146
}
147147
}
@@ -179,7 +179,7 @@ export function optimize (logic, engine, above = []) {
179179

180180
if (logic && typeof logic === 'object') {
181181
const idiomEnhancement = checkIdioms(logic, engine, above)
182-
if (idiomEnhancement) return idiomEnhancement
182+
if (typeof idiomEnhancement !== 'undefined') return idiomEnhancement
183183

184184
const keys = Object.keys(logic)
185185
const methodName = keys[0]

0 commit comments

Comments
 (0)