All Downloads are FREE. Search and download functionalities are using the official Maven repository.

node_modules.bower.lib.node_modules.mout.lang.createObject.js Maven / Gradle / Ivy

var mixIn = require('../object/mixIn');

    /**
     * Create Object using prototypal inheritance and setting custom properties.
     * - Mix between Douglas Crockford Prototypal Inheritance  and the EcmaScript 5 `Object.create()` method.
     * @param {object} parent    Parent Object.
     * @param {object} [props] Object properties.
     * @return {object} Created object.
     */
    function createObject(parent, props){
        function F(){}
        F.prototype = parent;
        return mixIn(new F(), props);

    }
    module.exports = createObject;






© 2015 - 2024 Weber Informatics LLC | Privacy Policy