mirror of
				https://github.com/musix-org/musix-oss
				synced 2025-10-31 17:51:36 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			18 lines
		
	
	
		
			693 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			18 lines
		
	
	
		
			693 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| var isObject = require('../internals/is-object');
 | |
| var setPrototypeOf = require('../internals/object-set-prototype-of');
 | |
| 
 | |
| // makes subclassing work correct for wrapped built-ins
 | |
| module.exports = function ($this, dummy, Wrapper) {
 | |
|   var NewTarget, NewTargetPrototype;
 | |
|   if (
 | |
|     // it can work only with native `setPrototypeOf`
 | |
|     setPrototypeOf &&
 | |
|     // we haven't completely correct pre-ES6 way for getting `new.target`, so use this
 | |
|     typeof (NewTarget = dummy.constructor) == 'function' &&
 | |
|     NewTarget !== Wrapper &&
 | |
|     isObject(NewTargetPrototype = NewTarget.prototype) &&
 | |
|     NewTargetPrototype !== Wrapper.prototype
 | |
|   ) setPrototypeOf($this, NewTargetPrototype);
 | |
|   return $this;
 | |
| };
 | 
