<commit_before># µModel

[![Build Status](https:#travis-ci.org/eighttrackmind/umodel.png)](https:#travis-ci.org/eighttrackmind/umodel.png)
[![browser support](https:#ci.testling.com/eighttrackmind/umodel.png)](https:#ci.testling.com/eighttrackmind/umodel)

Tiny, generic, fully tested model.

```coffee
new umodel [data], [options]
```

`data` {Object} initialize the model with some data

`options` {Object}

- `separator` (default: `/`) separator for getting/setting nested keys

## API

`umodel.`

- `get key` get a key, throwing an error if a parent key is not set
- `set key, value` set a key, lazy-creating parent keys along the way if nested
- `setnx key, value` like `set`, but only if the given key has not been set yet
- `on "event1 [event2...], :[property]", fn` call `fn` with `key, [value], modelInstance` when an event is triggered
- `trigger event, key` trigger an event set with `.on`

## Usage

```coffee
Model = require 'umodel'

model = new Model<commit_msg>fix ci badges in readme<commit_after># µModel

[![Build Status](https://travis-ci.org/eighttrackmind/umodel.png)](https://travis-ci.org/eighttrackmind/umodel.png)
[![browser support](https://ci.testling.com/eighttrackmind/umodel.png)](https://ci.testling.com/eighttrackmind/umodel)

Tiny, generic, fully tested model.

```coffee
new umodel [data], [options]
```

`data` {Object} initialize the model with some data

`options` {Object}

- `separator` (default: `/`) separator for getting/setting nested keys

## API

`umodel.`

- `get key` get a key, throwing an error if a parent key is not set
- `set key, value` set a key, lazy-creating parent keys along the way if nested
- `setnx key, value` like `set`, but only if the given key has not been set yet
- `on "event1 [event2...], :[property]", fn` call `fn` with `key, [value], modelInstance` when an event is triggered
- `trigger event, key` trigger an event set with `.on`

## Usage

```coffee
Model = require 'umodel'

model = new Model
{'fraction_non_alphanumeric': 0.14634146341463414, 'fraction_numerical': 0.0020325203252032522, 'mean_word_length': 4.577903682719547, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, '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': '5651016', 'n_tokens_mistral': 683, 'n_tokens_neox': 648, 'n_words': 229}