Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/floatdrop/funsert
Functional assert library
https://github.com/floatdrop/funsert
Last synced: 17 days ago
JSON representation
Functional assert library
- Host: GitHub
- URL: https://github.com/floatdrop/funsert
- Owner: floatdrop
- License: mit
- Created: 2015-07-29T05:57:06.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-07-30T08:15:33.000Z (over 9 years ago)
- Last Synced: 2024-09-21T08:59:04.935Z (about 2 months ago)
- Language: JavaScript
- Size: 133 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# funsert [![Build Status](https://travis-ci.org/floatdrop/funsert.svg?branch=master)](https://travis-ci.org/floatdrop/funsert)
> Functional assert library
## Install
```
$ npm install --save funsert
```## Usage
```js
var is = require('funsert');var aboveFive = is.greaterThan(5);
var belowTen = is.ok(x => x < 10, 'below 10');
var inBounds = is(aboveFive, belowTen);inBounds(7);
inBounds(3);
//=> Throws '3 is not greater than 5'
```## API
This is still under heavy development. Happy to hear suggestions before `1.0.0` release!
### funsert(assertions...)
Compose assertions with `and` operation.
### funsert.ok(check, [message])
Runs `check` function and throws Error, if it returns `false`.
### Helpers
Funsert wraps some predicate functions from [predicates](https://github.com/wookieb/predicates):
- array
- equal
- lessThan
- greaterThan
- instanceOf
- hasOwnProperty
- hasProperty
- in
- matches
- strictEqual
- endsWith
- startsWith## License
MIT © [Vsevolod Strukchinsky](http://github.com/floatdrop)