<commit_before>[![npm version](https://img.shields.io/npm/v/notaryjs.svg)](https://www.npmjs.com/package/notaryjs)
[![CircleCI build](https://img.shields.io/circleci/project/github/gmunguia/notaryjs.svg)](https://circleci.com/gh/gmunguia/notaryjs/tree/master)

# notaryjs

Library allowing type checking of functions at runtime, using haskell-like function signatures.

## Install

`npm install --save notaryjs`

## Usage

### Basic: type signatures
```javascript
import { sign } from 'notaryjs'

const addNumbers = sign('number -> number -> number', (n, m) => n + m)

// The following call will work seamlessly.
const one = addNumbers(.5, .5)

// The following call will throw an error, warning about a signature violation.
const two = addNumbers('one', 1)
```

### Advanced: type classes<commit_msg>Add honest note about purpose of the project to readme.<commit_after>[![npm version](https://img.shields.io/npm/v/notaryjs.svg)](https://www.npmjs.com/package/notaryjs)
[![CircleCI build](https://img.shields.io/circleci/project/github/gmunguia/notaryjs.svg)](https://circleci.com/gh/gmunguia/notaryjs/tree/master)

# notaryjs

Library allowing type checking of functions at runtime, using haskell-like function signatures.
Actually, a toy project for learning js back in the days.

## Install

`npm install --save notaryjs`

## Usage

### Basic: type signatures
```javascript
import { sign } from 'notaryjs'

const addNumbers = sign('number -> number -> number', (n, m) => n + m)

// The following call will work seamlessly.
const one = addNumbers(.5, .5)

// The following call will throw an error, warning about a signature violation.
const two = addNumbers('one', 1)
```

### Advanced: type classes
{'fraction_non_alphanumeric': 0.14512338425381904, 'fraction_numerical': 0.0035252643948296123, 'mean_word_length': 4.583606557377049, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 8, 'lorem ipsum': 0, 'www.': 2, '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': '3033722', 'n_tokens_mistral': 574, 'n_tokens_neox': 528, 'n_words': 157}