Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sleexyz/refinement
Combinatory Data Refinement DSL
https://github.com/sleexyz/refinement
Last synced: 1 day ago
JSON representation
Combinatory Data Refinement DSL
- Host: GitHub
- URL: https://github.com/sleexyz/refinement
- Owner: sleexyz
- Created: 2017-01-23T09:30:09.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-01-27T01:31:19.000Z (almost 8 years ago)
- Last Synced: 2024-09-06T08:37:33.437Z (2 months ago)
- Language: CoffeeScript
- Homepage:
- Size: 11.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# refinement
Combinatory Data Refinement DSL
**WIP don't use :p**
## Quick Start
```
import R from 'refinement'const ensureValidAPI = R.shape({
foo: R.string
bar: R.string
});console.log(R.toPred(ensureValidAPI)({
foo: "hello",
bar: "world"
)); // trueconsole.log(R.toPred(ensureValidAPI)({
foo: "hello",
bar: null
)); // false```
## Guide
```
import R from 'refinement'// ...
const foo = "hello";
R.string(foo)// ...
```## Conversions
`R` provides conversions between different representations:
#### `R.toPred` : Schema -> Predicate
#### `R.toPromise` : Schema -> Promise
#### `R.fromPred` : (Predicate, errorMessage?: String) -> Schema