https://github.com/dmannock/funchecks
Small, simple POC for type checking of functional data types.
https://github.com/dmannock/funchecks
Last synced: 3 months ago
JSON representation
Small, simple POC for type checking of functional data types.
- Host: GitHub
- URL: https://github.com/dmannock/funchecks
- Owner: dmannock
- License: mit
- Created: 2017-05-07T19:40:04.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-05-07T20:54:44.000Z (almost 9 years ago)
- Last Synced: 2025-10-10T15:56:38.477Z (7 months ago)
- Language: JavaScript
- Size: 20.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# funchecks (functional-data-type-checks)
Small, simple POC for type checking of functional data types. No production dependencies, only ~3KB (1.3KB gzipped).
## Dependencies ##
- All you need is either node or a browser
- Works on any machine
- No dependencies on other packages (with the exception of dev dependencies to build for browsers)
## Potential uses
* Unit testing
* Debugging
* Other assertions
## Features ##
### isFunctor (object -> boolean)
```js
funchecks.isFunctor(object)
```
### isMonad (object -> boolean)
```js
funchecks.isMonad(object)
```
### isMonoid (object, [optional] type -> boolean)
```js
funchecks.isMonoid(object, type?)
```
### isSemigroup (object, [optional] type -> boolean)
```js
funchecks.isSemigroup(object, type?)
```
### typeOfData (object, [optional] type -> string)
```js
funchecks.typeOfData(object, type?)
```
Return string is a constant that should be checked against funchecks.dataTypes
Examples:
```js
//string is a semigroup
funchecks.typeOfData('what am I?') === funchecks.dataTypes.SEMIGROUP;
//array is a functor
funchecks.typeOfData([]) === funchecks.dataTypes.FUNCTOR;
```
### dataTypes (constants)
* FUNCTOR
* SEMIGROUP
* MONOID
* MONAD
## Installation ##
Npm:
```shell
npm install --save funchecks
```
Browser:
```html
```
## Licence ##
MIT