UNPKG

512 BJavaScriptView Raw
1var createObject = require('./createObject');
2
3 /**
4 * Inherit prototype from another Object.
5 * - inspired by Nicholas Zackas <http://nczonline.net> Solution
6 * @param {object} child Child object
7 * @param {object} parent Parent Object
8 */
9 function inheritPrototype(child, parent){
10 var p = createObject(parent.prototype);
11 p.constructor = child;
12 child.prototype = p;
13 child.super_ = parent;
14 return p;
15 }
16
17 module.exports = inheritPrototype;
18