Base implementation for composite patterns in JavaScript.