generate.js
function defineObjectProperties(obj, descriptor, properties) {
        var setProperties = {},
            i,
            keys,
            length,

            p = properties || descriptor,
            d = properties && descriptor;

        properties = (p && typeof p === 'object') ? p : {};
        descriptor = (d && typeof d === 'object') ? d : {};

        keys = Object.getOwnPropertyNames(properties);
        length = keys.length;

        for (i = 0; i < length; i++) {
            if (isGetSet(properties[keys[i]])) {
                setProperties[keys[i]] = {
                    configurable: !!descriptor.configurable,
                    enumerable: !!descriptor.enumerable,
                    get: properties[keys[i]].get,
                    set: properties[keys[i]].set
                };
            } else {
                setProperties[keys[i]] = {
                    configurable: !!descriptor.configurable,
                    enumerable: !!descriptor.enumerable,
                    writable: !!descriptor.writable,
                    value: properties[keys[i]]
                };
            }
        }
        Object.defineProperties(obj, setProperties);
        return obj;
    }
function defineObjectProperties(obj, descriptor, properties) {
        var setProperties = {},
            i,
            keys,
            length,

            p = properties || descriptor,
            d = properties && descriptor;

        properties = (p && typeof p === 'object') ? p : {};
        descriptor = (d && typeof d === 'object') ? d : {};

        keys = Object.getOwnPropertyNames(properties);
        length = keys.length;

        for (i = 0; i < length; i++) {
            if (isGetSet(properties[keys[i]])) {
                setProperties[keys[i]] = {
                    configurable: !!descriptor.configurable,
                    enumerable: !!descriptor.enumerable,
                    get: properties[keys[i]].get,
                    set: properties[keys[i]].set
                };
            } else {
                setProperties[keys[i]] = {
                    configurable: !!descriptor.configurable,
                    enumerable: !!descriptor.enumerable,
                    writable: !!descriptor.writable,
                    value: properties[keys[i]]
                };
            }
        }
        Object.defineProperties(obj, setProperties);
        return obj;
    }
function defineObjectProperties ( obj , descriptor , properties ) { var setProperties = { } , i , keys , length , p = properties || descriptor , d = properties && descriptor ; properties = ( p && typeof p === 'object' ) ? p : { } ; descriptor = ( d && typeof d === 'object' ) ? d : { } ; keys = Object . getOwnPropertyNames ( properties ) ; length = keys . length ; for ( i = 0 ; i < length ; i ++ ) { if ( isGetSet ( properties [ keys [ i ] ] ) ) { setProperties [ keys [ i ] ] = { configurable : ! ! descriptor . configurable , enumerable : ! ! descriptor . enumerable , get : properties [ keys [ i ] ] . get , set : properties [ keys [ i ] ] . set } ; } else { setProperties [ keys [ i ] ] = { configurable : ! ! descriptor . configurable , enumerable : ! ! descriptor . enumerable , writable : ! ! descriptor . writable , value : properties [ keys [ i ] ] } ; } } Object . defineProperties ( obj , setProperties ) ; return obj ; }
Defines properties on 'obj'.
@param  {Object} obj        An object that 'properties' will be attached to.
@param  {Object} descriptor Optional object descriptor that will be applied to all attaching properties on 'properties'.
@param  {Object} properties An object who's properties will be attached to 'obj'.
@return {Generator}         'obj'.
Defines properties on obj .