<commit_before>Plugins
===

Lawnchair deals in collections of json documents. Plugins augment lawnchair collections with particular behaviors.

    
    :::JavaScript
    // aggregation ... utilities for dealing with aggregate data; kinda happens with collecdtions
    // callbacks ..... event hooks fired before/after any adapter method call
    // pagination .... page collection data
    // query ......... query collection data 
    

If you'd like to create a plugin there are some great ideas listed in the roadmap. ;)

Aggregation
---

Aggregate data happens and when it does these sorts of methods can come
in handy.

    
    :::JavaScript
    Lawnchair(function() {
        // sum on a property
        this.sum('transactions', 'console.log(sum)')

        // get the average value of a property
        this.avg('score', 'console.log(avg)')

        // min value in the collection for a property
        this.min('temprature', 'console.log(min)')

        // max value in the collection for a property
        this.max('height', 'console.log(max)')
    })
    

Callbacks
---

Callbacks augment the `Lawnchair` api with `before` and `after` events.
Great for validations or conditional behavior.

    
    :::JavaScript
    Lawnchair(function() {

    })
    

Pagination
---

When you have lots of data it is common to page it. BONUS: the oposite
sex loves the word _paginate_. Gets 'em every time.

    
    :::JavaScript
    Lawnchair(function() {

    })
    

Query
---

Querying data can be tedious and ugly. The query plugin proposes a
JavaScript syntax for accessing data. 

    
    :::JavaScript
    Lawnchair(function() {
<commit_msg>docs for plugins finally<commit_after>Plugins
===

The `Lawnchair` deals in collections of json documents. Plugins augment lawnchair collections with particular behaviors. If you'd like to create a plugin there are some great ideas listed in the roadmap. ;)

Aggregation
---

Aggregate data happens and when it does these sorts of methods can come
in handy.

    
    :::JavaScript
    Lawnchair(function() {
        // sum on a property
        this.sum('transactions', 'console.log(sum)')

        // get the average value of a property
        this.avg('score', 'console.log(avg)')

        // min value in the collection for a property
        this.min('temprature', 'console.log(min)')

        // max value in the collection for a property
        this.max('height', 'console.log(max)')
    })
    

Callbacks
---

Callbacks augment the `Lawnchair` api with `before` and `after` events.
Great for validations or conditional behavior.

    
    :::JavaScript
    Lawnchair(function() {
        
        // setup some callbacks
        this.before('save', 'console.log("about to save " + record.name)')
        this.after('save', 'console.log(record.name + " has been saved")')
        
        this.save({name:'brian'})
        // about to save brian
        // brian has been saved
    })
    

Pagination
---

When you have lots of data it is common to page it. BONUS: the oposite
sex loves the word _paginate_. Gets 'em every time.

    
    :::JavaScript
    Lawnchair(function() {

    })
    

Query
---

Querying data can be tedious and ugly. The query plugin proposes a
JavaScript syntax for accessing data. 

    
    :::JavaScript
    Lawnchair(function() {

{'fraction_non_alphanumeric': 0.09972964854310604, 'fraction_numerical': 0.0, 'mean_word_length': 2.5126582278481013, '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': '3340080', 'n_tokens_mistral': 957, 'n_tokens_neox': 908, 'n_words': 355}