<commit_before># Mercury RouterComponent

This is a mercury router component from Raynos : https://gist.github.com/adbf7951bee3fdfe1a65

Mercury is a FRP JS framework based on the idea of tiny modules: https://github.com/Raynos/mercury

## Install

```
npm install mercury-router
```

## Usage

``` js
var mercury = require('mercury');
var h = require('mercury').h;
var RouterComponent = require('mercury-router');
var anchor = RouterComponent.anchor;
var Router = RouterComponent; 

function App() {
  var state = mercury.state({
    route: Router()
  });
  return state;
}
    
mercury.app(document.body, App(), render);
      
function render(state) {
  return h('div', [
    menu(),
    RouterComponent.render(state, {
      '/': function() {
        return h('h1', ['Home']);
      },
      '/animals': function() {
        return h('h1', ['Animals']);
      },
      '/animals/:id': function(params) {
        return h('h1', ['Animals ' + params.id]);
      }
    })
  ]);
}

```

## Credits

Created By [@Raynos](https://github.com/Raynos)






<commit_msg>update readme with test badge<commit_after># Mercury RouterComponent

This is a mercury router component from Raynos : https://gist.github.com/adbf7951bee3fdfe1a65

Mercury is a FRP JS framework based on the idea of tiny modules: https://github.com/Raynos/mercury

[![Build Status](https://travis-ci.org/twilson63/mercury-router.svg?branch=master)](https://travis-ci.org/twilson63/mercury-router)

## Install

```
npm install mercury-router
```

## Usage

``` js
var mercury = require('mercury');
var h = require('mercury').h;
var RouterComponent = require('mercury-router');
var anchor = RouterComponent.anchor;
var Router = RouterComponent; 

function App() {
  var state = mercury.state({
    route: Router()
  });
  return state;
}
    
mercury.app(document.body, App(), render);
      
function render(state) {
  return h('div', [
    menu(),
    RouterComponent.render(state, {
      '/': function() {
        return h('h1', ['Home']);
      },
      '/animals': function() {
        return h('h1', ['Animals']);
      },
      '/animals/:id': function(params) {
        return h('h1', ['Animals ' + params.id]);
      }
    })
  ]);
}

```

## Credits

Created By [@Raynos](https://github.com/Raynos)







{'fraction_non_alphanumeric': 0.16761737604212373, 'fraction_numerical': 0.011408512505484861, 'mean_word_length': 3.230055658627087, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 8, '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': '2291341', 'n_tokens_mistral': 789, 'n_tokens_neox': 752, 'n_words': 174}