lib/index.js
function(z_real, w_copy, s_property) {

	// property is a function (ie: instance method)
	if('function' === typeof z_real[s_property]) {

		// implement same method name in virtual object
		w_copy[s_property] = function() {

			// forward to real class
			return z_real[s_property].apply(z_real, arguments);
		};
	}
	// read/write property
	else {

		// try to override object property
		try {
			Object.defineProperty(w_copy, s_property, {

				// grant user full capability to modify this property
				configurable: true,

				// give enumerability setting same value as original
				enumerable: z_real.propertyIsEnumerable(s_property),

				// fetch property from real object
				get: () => {
					return z_real[s_property];
				},

				// set property on real object
				set: (z_value) => {
					z_real[s_property] = z_value;
				},
			});
		}
		// cannot redefine property
		catch(d_redef_err) {

			// try again, this time only set the value and enumerability
			try {
				Object.defineProperty(w_copy, s_property, {

					// give enumerability setting same value as original
					enumerable: z_real.propertyIsEnumerable(s_property),

					// mask w undef
					value: undefined,
				});

				// was not exepecting this property to give us trouble
				if(!A_TROUBLE_PROPERTIES.includes(s_property)) {
					console.warn('was not expecting "'+s_property+'" to prohibit redefinition on '+arginfo(w_copy));
				}
			}
			// cannot even do that?!
			catch(d_enum_err) {

				// last try, this time only set the value
				try {
					Object.defineProperty(w_copy, s_property, {

						// mask w undef
						value: undefined,
					});

					// was not exepecting this property to give us trouble
					if(!A_TROUBLE_PROPERTIES.includes(s_property)) {
						console.warn('was not expecting "'+s_property+'" to prohibit redefinition on '+arginfo(w_copy));
					}
				}
				// fail
				catch(d_value_err) {
					throw 'cannot override property "'+s_property+'" on '+arginfo(w_copy);
				}
			}
		}
	}
}
function(z_real, w_copy, s_property) {

	// property is a function (ie: instance method)
	if('function' === typeof z_real[s_property]) {

		// implement same method name in virtual object
		w_copy[s_property] = function() {

			// forward to real class
			return z_real[s_property].apply(z_real, arguments);
		};
	}
	// read/write property
	else {

		// try to override object property
		try {
			Object.defineProperty(w_copy, s_property, {

				// grant user full capability to modify this property
				configurable: true,

				// give enumerability setting same value as original
				enumerable: z_real.propertyIsEnumerable(s_property),

				// fetch property from real object
				get: () => {
					return z_real[s_property];
				},

				// set property on real object
				set: (z_value) => {
					z_real[s_property] = z_value;
				},
			});
		}
		// cannot redefine property
		catch(d_redef_err) {

			// try again, this time only set the value and enumerability
			try {
				Object.defineProperty(w_copy, s_property, {

					// give enumerability setting same value as original
					enumerable: z_real.propertyIsEnumerable(s_property),

					// mask w undef
					value: undefined,
				});

				// was not exepecting this property to give us trouble
				if(!A_TROUBLE_PROPERTIES.includes(s_property)) {
					console.warn('was not expecting "'+s_property+'" to prohibit redefinition on '+arginfo(w_copy));
				}
			}
			// cannot even do that?!
			catch(d_enum_err) {

				// last try, this time only set the value
				try {
					Object.defineProperty(w_copy, s_property, {

						// mask w undef
						value: undefined,
					});

					// was not exepecting this property to give us trouble
					if(!A_TROUBLE_PROPERTIES.includes(s_property)) {
						console.warn('was not expecting "'+s_property+'" to prohibit redefinition on '+arginfo(w_copy));
					}
				}
				// fail
				catch(d_value_err) {
					throw 'cannot override property "'+s_property+'" on '+arginfo(w_copy);
				}
			}
		}
	}
}
function ( z_real , w_copy , s_property ) { // property is a function (ie: instance method) if ( 'function' === typeof z_real [ s_property ] ) { // implement same method name in virtual object w_copy [ s_property ] = function ( ) { // forward to real class return z_real [ s_property ] . apply ( z_real , arguments ) ; } ; } // read/write property else { // try to override object property try { Object . defineProperty ( w_copy , s_property , { // grant user full capability to modify this property configurable : true , // give enumerability setting same value as original enumerable : z_real . propertyIsEnumerable ( s_property ) , // fetch property from real object get : ( ) => { return z_real [ s_property ] ; } , // set property on real object set : ( z_value ) => { z_real [ s_property ] = z_value ; } , } ) ; } // cannot redefine property catch ( d_redef_err ) { // try again, this time only set the value and enumerability try { Object . defineProperty ( w_copy , s_property , { // give enumerability setting same value as original enumerable : z_real . propertyIsEnumerable ( s_property ) , // mask w undef value : undefined , } ) ; // was not exepecting this property to give us trouble if ( ! A_TROUBLE_PROPERTIES . includes ( s_property ) ) { console . warn ( 'was not expecting "' + s_property + '" to prohibit redefinition on ' + arginfo ( w_copy ) ) ; } } // cannot even do that?! catch ( d_enum_err ) { // last try, this time only set the value try { Object . defineProperty ( w_copy , s_property , { // mask w undef value : undefined , } ) ; // was not exepecting this property to give us trouble if ( ! A_TROUBLE_PROPERTIES . includes ( s_property ) ) { console . warn ( 'was not expecting "' + s_property + '" to prohibit redefinition on ' + arginfo ( w_copy ) ) ; } } // fail catch ( d_value_err ) { throw 'cannot override property "' + s_property + '" on ' + arginfo ( w_copy ) ; } } } } }
creates a transparent property on w_copy using z_real
creates a transparent property on w_copy using z_real