# Conditioning Groups

Conditioning groups would perform multiple comparisons, and return a single string, binary, or hex value

``````/*
Cond(x,...,flags[, cb])
2+ input parameters + flags (sign/unsigned) + (optional) callback;
Possible flags : [!]eq [!]lt [!]gt [!]le [!]ge [!]be [!]ae
test x == y (false); x != y (true); x < y (true); returns 0x11
*/
let x=5
let y=9
let cases = Cond(x,y,'eq !eq lt') // 0x11
``````

The idea is to use conditioning groups in javascript to model processing nodes in optical networks

So what's the benefit over `const cases = (x === y) << 2 + (x !== y) << 1 + (x < y);` ?
And why do you think this is needs to be implemented natively in a general purpose language like JS, when this can easily be created with two lines of code?

``````const eq = (a, b) => a === b, neq = (a, b) => a !== b, lt = (a, b) => a < b;
const cond = (...cmps) => (a, b) => cmps.reverse().reduce((res, cb, i) => res + (cb(a, b) << i), 0);
cond(eq, neq, lt)(5, 9) // 3
``````

This sounds far too specialized of a use case to belong in the spec IMHO.