Created
          October 13, 2011 15:55 
        
      - 
      
- 
        Save bobrik/1284614 to your computer and use it in GitHub Desktop. 
    es5 inheritance
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | exports.spawn = function(parent, props) { | |
| var key, | |
| defs = { | |
| _parent: { value: parent, enumerable: true } | |
| }; | |
| for (key in props) { | |
| if (props.hasOwnProperty(key)) { | |
| defs[key] = { | |
| value : props[key], | |
| enumerable : true | |
| }; | |
| } | |
| } | |
| return Object.create(parent, defs); | |
| }; | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment