javascript monoid