<commit_before>zoe.js
======

Natural JavaScript inheritance.

For comprehensive documentation see [http://zoejs.org/docs].

Usage Examples
---

### Static Class

```javascript
  var ModelClassDefinition = {
    // specify the class extension rules
    _extend: {
      items: 'ARR_APPEND',
      addItem: 'CHAIN'
    },

    // class properties just object properties
    items: ['initial data item'],
    loadData: function() {
      this.data = [1, 4, 5];
    },
    addItem: function(item) {
      this.data.push(item);
    }
  };

  // creating the class extends each implemented class definition onto a new object, using the extension rules
  // 'items' gets array-appended, causing the item list to be generated
  // 'addItem' function gets chained, causing the functions to run one after the other
  var myModel = zoe.create([ModelClassDefinition], {
    items: ['extra initial data'],
    addItem: function(item) {
      console.log('added item ' + item);
    }
  });
  myModel.loadData();
  myModel.addItem(10);
  console.log(myModel.items);
```

### Extending a Static Class

```javascript
  // a double underscore notation can allow for setting extension rules in the property name itself
  // here, 'addItem' is replaced by the new function, and the 'items' array is prepended.
  var newModel = zoe.create([ModelClassDefinition], {
    __addItem__: function(item) {
      console.log('replaced add item method entirely');
    },
    items__: ['very first data item']
  });
  newModel.loadData();
  newModel.addItem(10);
  console.log(newModel.items);
```

### Prototypal Inheritance

```javascript
  // zoe.Constructor is an implementor providing extension rules for standard prototypal inheritance
  var Ball = zoe.create([zoe.Constructor], {
    _extend: {
      'prototype.setColor': 'CHAIN'
    },
    construct: function(color) {
      this.color = color || 'blue';
    },
    prototype: {
      setColor: function(color) {
        this.color = color;
      },
      getColor: function() {
        return this.color;
      }
    }
  });

  // the class instance is now the Object Constructor to be instantiated
  var myBall = new Ball('yellow');
  myBall.getColor();

  // the prototype and constructor are extended naturally by default by zoe.Constructor
  var BouncingBall = zoe.create([Ball], {
    construct: function(color) {
      this.bouncing = false;
    },
    prototype: {
      setColor: function(color) {
        console.log('the ' + (this.bouncing ? 'bouncing' : 'stationary') + ' ball is now ' + color);
      },
      bounce: function() {
        this.bouncing = true;
        console.log('bouncing');
      },
      stop: function() {
        this.bouncing = false;<commit_msg>split up readme<commit_after>zoe.js
======

Natural JavaScript inheritance.

For comprehensive documentation see [http://zoejs.org/docs].

Usage Examples
---

### Static Class

```javascript
  var ModelClassDefinition = {
    // specify the class extension rules
    _extend: {
      items: 'ARR_APPEND',
      addItem: 'CHAIN'
    },

    // class properties just object properties
    items: ['initial data item'],
    loadData: function() {
      this.data = [1, 4, 5];
    },
    addItem: function(item) {
      this.data.push(item);
    }
  };

  // creating the class extends each implemented class definition onto a new object, using the extension rules
  // 'items' gets array-appended, causing the item list to be generated
  // 'addItem' function gets chained, causing the functions to run one after the other
  var myModel = zoe.create([ModelClassDefinition], {
    items: ['extra initial data'],
    addItem: function(item) {
      console.log('added item ' + item);
    }
  });
  myModel.loadData();
  myModel.addItem(10);
  console.log(myModel.items);
```

### Extending a Static Class

```javascript
  // a double underscore notation can allow for setting extension rules in the property name itself
  // here, 'addItem' is replaced by the new function, and the 'items' array is prepended.
  var newModel = zoe.create([ModelClassDefinition], {
    __addItem__: function(item) {
      console.log('replaced add item method entirely');
    },
    items__: ['very first data item']
  });
  newModel.loadData();
  newModel.addItem(10);
  console.log(newModel.items);
```

### Prototype Classes

```javascript
  // zoe.Constructor is an implementor providing extension rules for standard prototypal inheritance
  var Ball = zoe.create([zoe.Constructor], {
    _extend: {
      'prototype.setColor': 'CHAIN'
    },
    construct: function(color) {
      this.color = color || 'blue';
    },
    prototype: {
      setColor: function(color) {
        this.color = color;
      },
      getColor: function() {
        return this.color;
      }
    }
  });

  // the class instance is now the Object Constructor to be instantiated
  var myBall = new Ball('yellow');
  myBall.getColor();
```

### Multiple Prototypal Extension
```javascript
  // the prototype and constructor are extended naturally by default by zoe.Constructor
  var BouncingBall = zoe.create([Ball], {
    construct: function(color) {
      this.bouncing = false;
    },
    prototype: {
      setColor: function(color) {
        console.log('the ' + (this.bouncing ? 'bouncing' : 'stationary') + ' ball is now ' + color);
      },
      bounce: function() {
        this.bouncing = true;
        console.log('bouncing');
      },
      stop: function() {
        this.bouncing = false;
{'fraction_non_alphanumeric': 0.1247944454595286, 'fraction_numerical': 0.0025580120591997078, 'mean_word_length': 2.92964824120603, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '434121', 'n_tokens_mistral': 1654, 'n_tokens_neox': 1572, 'n_words': 481}