src/topiarist.js
function inherit(target, parent) {
	assertArgumentOfType('function', target, ERROR_MESSAGES.NOT_CONSTRUCTOR, 'Target', 'inherit');
	parent = toFunction(
		parent,
		new TypeError(
			msg(
				ERROR_MESSAGES.WRONG_TYPE,
				'Parent',
				'inherit',
				'non-null object or function',
				parent === null ? 'null' : typeof parent
			)
		)
	);

	if (classIsA(target, parent)) {
		return target;
	}

	var resultingProperties = {};
	var targetPrototype = target.prototype;
	for (var propertyName in parent.prototype) {
		// These properties should be nonenumerable in modern browsers, but shims might create them in ie8.
		if (propertyName === 'constructor' || propertyName === '__proto__' || propertyName === 'toString' || propertyName.match(/^Symbol\(__proto__\)/)) {
			continue;
		}

		var notInTarget = targetPrototype[propertyName] === undefined;
		var parentHasNewerImplementation = notInTarget || isOverriderOf(propertyName, parent, target);
		if (parentHasNewerImplementation) {
			resultingProperties[propertyName] = parent.prototype[propertyName];
		} else {
			var areTheSame = targetPrototype[propertyName] === parent.prototype[propertyName];
			var targetIsUpToDate = areTheSame || isOverriderOf(propertyName, target, parent);
			if (targetIsUpToDate === false) {
				// target is not up to date, but we can't bring it up to date.
				throw new Error(
					msg(
						ERROR_MESSAGES.ALREADY_PRESENT,
						propertyName,
						className(parent, 'parent'),
						className(target, 'target')
					)
				);
			}
			// otherwise we don't need to do anything.
		}
	}

	copy(resultingProperties, targetPrototype);
	var multiparents = nonenum(target, '__multiparents__', []);
	multiparents.push(parent);

	clearAssignableCache(target, parent);

	return target;
}
function inherit(target, parent) {
	assertArgumentOfType('function', target, ERROR_MESSAGES.NOT_CONSTRUCTOR, 'Target', 'inherit');
	parent = toFunction(
		parent,
		new TypeError(
			msg(
				ERROR_MESSAGES.WRONG_TYPE,
				'Parent',
				'inherit',
				'non-null object or function',
				parent === null ? 'null' : typeof parent
			)
		)
	);

	if (classIsA(target, parent)) {
		return target;
	}

	var resultingProperties = {};
	var targetPrototype = target.prototype;
	for (var propertyName in parent.prototype) {
		// These properties should be nonenumerable in modern browsers, but shims might create them in ie8.
		if (propertyName === 'constructor' || propertyName === '__proto__' || propertyName === 'toString' || propertyName.match(/^Symbol\(__proto__\)/)) {
			continue;
		}

		var notInTarget = targetPrototype[propertyName] === undefined;
		var parentHasNewerImplementation = notInTarget || isOverriderOf(propertyName, parent, target);
		if (parentHasNewerImplementation) {
			resultingProperties[propertyName] = parent.prototype[propertyName];
		} else {
			var areTheSame = targetPrototype[propertyName] === parent.prototype[propertyName];
			var targetIsUpToDate = areTheSame || isOverriderOf(propertyName, target, parent);
			if (targetIsUpToDate === false) {
				// target is not up to date, but we can't bring it up to date.
				throw new Error(
					msg(
						ERROR_MESSAGES.ALREADY_PRESENT,
						propertyName,
						className(parent, 'parent'),
						className(target, 'target')
					)
				);
			}
			// otherwise we don't need to do anything.
		}
	}

	copy(resultingProperties, targetPrototype);
	var multiparents = nonenum(target, '__multiparents__', []);
	multiparents.push(parent);

	clearAssignableCache(target, parent);

	return target;
}
function inherit ( target , parent ) { assertArgumentOfType ( 'function' , target , ERROR_MESSAGES . NOT_CONSTRUCTOR , 'Target' , 'inherit' ) ; parent = toFunction ( parent , new TypeError ( msg ( ERROR_MESSAGES . WRONG_TYPE , 'Parent' , 'inherit' , 'non-null object or function' , parent === null ? 'null' : typeof parent ) ) ) ; if ( classIsA ( target , parent ) ) { return target ; } var resultingProperties = { } ; var targetPrototype = target . prototype ; for ( var propertyName in parent . prototype ) { // These properties should be nonenumerable in modern browsers, but shims might create them in ie8. if ( propertyName === 'constructor' || propertyName === '__proto__' || propertyName === 'toString' || propertyName . match ( / ^Symbol\(__proto__\) / ) ) { continue ; } var notInTarget = targetPrototype [ propertyName ] === undefined ; var parentHasNewerImplementation = notInTarget || isOverriderOf ( propertyName , parent , target ) ; if ( parentHasNewerImplementation ) { resultingProperties [ propertyName ] = parent . prototype [ propertyName ] ; } else { var areTheSame = targetPrototype [ propertyName ] === parent . prototype [ propertyName ] ; var targetIsUpToDate = areTheSame || isOverriderOf ( propertyName , target , parent ) ; if ( targetIsUpToDate === false ) { // target is not up to date, but we can't bring it up to date. throw new Error ( msg ( ERROR_MESSAGES . ALREADY_PRESENT , propertyName , className ( parent , 'parent' ) , className ( target , 'target' ) ) ) ; } // otherwise we don't need to do anything. } } copy ( resultingProperties , targetPrototype ) ; var multiparents = nonenum ( target , '__multiparents__' , [ ] ) ; multiparents . push ( parent ) ; clearAssignableCache ( target , parent ) ; return target ; }
Provides multiple inheritance through copying.

<p>This is discouraged; you should prefer to use aggregation first, single inheritance (extends) second, mixins
third and this as a last resort.</p>

@memberOf topiarist
@param {function} target the class that should receive the functionality.
@param {function|Object} parent the parent that provides the functionality.
Provides multiple inheritance through copying .