<commit_before>Inheritance.js
==============

Provides two simple methods for working with inheritance and objects. This

inherit(Parent, methods, properties)
------------------------------------

Creates a new constructor function that inherits from a parent constructor.
Instance and static methods can also be provided as additional arguments, if the
`methods` argument has a property called __constructor__ this will be
used as the constructor function.

### Arguments

 - `parent`: A constructor Function to inherit from.
 - `methods`: An Object literal of instance methods that are added to the
    constructors prototype (optional).
 - `properties` - An Object literal of static/class methods to add to the
   constructor itself (optional).

### Examples

```javascript
// Original function to inherit from.
function MyObject() {};

var SubClass = inherit(MyObject, {
  instanceMethod: function () {}
}, {
  staticProp: 'some-string',
  staticMethod: function () {}
});

var instance = new SubClass();
instance instanceof MyObject   //=> true
typeof instance.instanceMethod //=> "function"
typeof SubClass.staticMethod   //=> "function"
```

A `__super__` property is made available to all child classes that points to
the parent `prototype` object. This can be used in methods to call the parent.

```javascript
// Original function to inherit from.
function MyObject() {};
MyObject.prototype.say = function () { return 'Hello'; }

var SubClass = inherit(MyObject, {
  constructor: function SubClass() {
    this.__super__.constructor.apply(this, arguments);
    // Set up other properties.
  },
  say: function () {
    return this.__super__.say.apply(this, arguments) + ' World';
  }
});

(new SubClass()).say(); //=> 'Hello World'
```

mixin(target [ , arguments... ])
--------------------------------

Extends an object with the properties on successive arguments. Returns the
first argument. Properties will be copied from right to left with the right
overriding the left.

### Arguments

 - `target`: The object that is to be extended.
 - `arguments*`: Properties from all successive arguments will be copied to the target.

### Examples

```javascript
mixin({type: 'person'}, {name: 'bill', age: 20}, {age: 21});
//=> {type: 'person', name: 'bill', age: 21}
```

License
-------

Released under the MIT license<commit_msg>Updated README with details on create() function<commit_after>Inheritance.js
==============

Provides two simple methods for working with inheritance and objects. This

inherit(Parent, methods, properties)
------------------------------------

Creates a new constructor function that inherits from a parent constructor.
Instance and static methods can also be provided as additional arguments, if the
`methods` argument has a property called __constructor__ this will be
used as the constructor function.

### Arguments

 - `parent`: A constructor Function to inherit from.
 - `methods`: An Object literal of instance methods that are added to the
    constructors prototype (optional).
 - `properties` - An Object literal of static/class methods to add to the
   constructor itself (optional).

### Examples

```javascript
// Original function to inherit from.
function MyObject() {};

var SubClass = inherit(MyObject, {
  instanceMethod: function () {}
}, {
  staticProp: 'some-string',
  staticMethod: function () {}
});

var instance = new SubClass();
instance instanceof MyObject   //=> true
typeof instance.instanceMethod //=> "function"
typeof SubClass.staticMethod   //=> "function"
```

A `__super__` property is made available to all child classes that points to
the parent `prototype` object. This can be used in methods to call the parent.

```javascript
// Original function to inherit from.
function MyObject() {};
MyObject.prototype.say = function () { return 'Hello'; }

var SubClass = inherit(MyObject, {
  constructor: function SubClass() {
    this.__super__.constructor.apply(this, arguments);
    // Set up other properties.
  },
  say: function () {
    return this.__super__.say.apply(this, arguments) + ' World';
  }
});

(new SubClass()).say(); //=> 'Hello World'
```

mixin(target [ , arguments... ])
--------------------------------

Extends an object with the properties on successive arguments. Returns the
first argument. Properties will be copied from right to left with the right
overriding the left.

### Arguments

 - `target`: The object that is to be extended.
 - `arguments*`: Properties from all successive arguments will be copied to the target.

### Examples

```javascript
mixin({type: 'person'}, {name: 'bill', age: 20}, {age: 21});
//=> {type: 'person', name: 'bill', age: 21}
```

create(parent)
--------------

Creates a new object instance and sets it's internal prototype to the parent
argument provided. This is based on [Crockford's Object.create()][#create] but
will use the native `Object.create()` if present.

[#create]: http://javascript.crockford.com/prototypal.html

### Arguments

 - `parent`: An object to use for the new objects internal prototype.

### Examples

```javascript
var appleObject = {color: 'green'}
var appleInstance = create(appleObject);

appleInstance.hasOwnProperty('color'); //=> false
appleInstance.color === appleObject.color; //=> true
```

License
-------

Released under the MIT license
{'fraction_non_alphanumeric': 0.14606106294760648, 'fraction_numerical': 0.0022615906520919715, 'mean_word_length': 3.734165923282783, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3558283', 'n_tokens_mistral': 1403, 'n_tokens_neox': 1345, 'n_words': 575}