Chainchainchain favors composition over inheritance without breaking JavaScript.

const chain = require ( ' chainchainchain ' ) let xo = { x : ' x ' } let yo = { y : ' y ' } let zo = { z : ' z ' } let fo = { f ( ) { return this . x + this . y + this . z } } let ch = chain ( xo , yo , zo , fo ) ch . x + ch . y + ch . z ch . f ( ) xo . x = yo . y = zo . z = ' chain ' ch . x + ch . y + ch . z ch . f ( )