-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make sure that mapOf also accepts Map type
- Loading branch information
Maurits Rijk
committed
Apr 12, 2017
1 parent
7ff2b9d
commit 0998d8c
Showing
6 changed files
with
53 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,4 @@ Instrumentation hints: | |
|
||
Other TODO: | ||
|
||
- add documentation | ||
|
||
- Use speculaas to test speculaas! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
and | ||
===== | ||
|
||
Usage: ```and(...)``` | ||
|
||
Returns a spec that returns the conformed value. Succesive conformed values propagate | ||
through rest of predicates | ||
|
||
[Source](https://github.com/mrijk/speculaas/blob/master/lib/and.js) | ||
|
||
Example: | ||
|
||
```js | ||
const s = require('speculaas'); | ||
const {isBoolean, isString} = require('lodash'); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
mapOf | ||
===== | ||
|
||
Usage: ```mapOf(kpred, vpred, opts)``` | ||
|
||
Returns a spec for a map whose keys satisfy kpred and vals satisfy vpred. | ||
|
||
[Source](https://github.com/mrijk/speculaas/blob/master/lib/mapOf.js) | ||
|
||
Example: | ||
|
||
```js | ||
const s = require('speculaas'); | ||
const {isInteger, isString} = require('lodash'); | ||
|
||
s.def('::scores', s.mapOf(isString, isInteger)); | ||
|
||
s.isValid('::scores', {'Sally': 1000, 'Joe': 500}); | ||
// true | ||
|
||
s.isValid('::scores', {'Sally': 1000, 'Joe': '500'}); | ||
// false | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters