Class Merge =========== Merge of additional (mixin) Classes into an primary (base) class About ----- Class Merge is a very small JavaScript library for Node.js environments, providing just a single function for use in ECMAScript 6 class inheritance. It aggregates/merges a base class and one or more mixin classes into an aggregate class, which then is usually subsequently used as the base class for another class. Installation ------------ ```shell $ npm install @uci-utils/class-merge ``` Usage ----- #### ECMAScript 6 requires using -r esm ```js import merge from '@uci-utils/class-merge' class Colored { initializer () { this._color = "white" } get color () { return this._color } set color (v) { this._color = v } } class ZCoord { initializer () { this._z = 0 } get z () { return this._z } set z (v) { this._z = v } } class Shape { constructor (x, y) { this._x = x; this._y = y } get x () { return this._x } set x (v) { this._x = v } get y () { return this._y } set y (v) { this._y = v } } class Rectangle extends merge(Shape, Colored, ZCoord) {} var rect = new Rectangle(7, 42) rect.z = 1000 rect.color = "red" Credits ------- thx to aggregation 2015-2019 by Dr. Ralf S. Engelschall (http://engelschall.com/)