A 属性 取决于其他属性

A property that depends on other properties

全部

我经常发现自己编写如下代码:

// A, B - are properties defined elsewhere.
let C = Bacon.update(
    null,

    [
        A,
        B,
        Bacon.mergeAll(A.changes(), B.changes())
    ],
    (_, a, b) => getC(a, b)

);

对我来说,这看起来像是一种 DRY 违规和可读性差。如何改进上面的代码?

为什么不

let C = Bacon.combineWith(A, B, getC)

let C = A.combine(B, getC)

...等价。