UNPKG

rafa

Version:

Rafa.js is a Javascript framework for building concurrent applications.

33 lines (25 loc) 840 B
// Shallow copy of other's properties to dest. function extend(dest, ...others) { let other, property, i; const len = others.length; for (i = 0; i < len; i++) { other = others[i]; for (property in other) { if (other.hasOwnProperty(property)) { dest[property] = other[property]; } } } return dest; } // Create a prototype object on `constructor` using `Parent` and a base // overlayed by `prototype`. function inherit(constructor, parent, prototype) { extend(extend(constructor.prototype, parent.prototype || parent), prototype); } // No operation returning undefined. `() => undefined` function noop() {} // The identity function always returns the first argument. `a => a` function identity(a) { return a; } // Function returns `this`. `() => this` function contextid() { return this; }