functional-abstraction/measure

View on GitHub
src/0-core/1-monoids/Product.js

Summary

Maintainability
A
0 mins
Test Coverage
export class Product {
    constructor(a, b) {
        this.a = a;
        this.b = b;
    }

    zero() {
        return [this.a.zero(), this.b.zero()];
    }

    /**
     * @param first
     * @param second
     */
    plus([a, b], [A, B]) {
        return [this.a.plus(a, A), this.b.plus(b, B)];
    }
}

export function product(a, b) {
    return new Product(a, b);
}