Comparing version 3.0.0 to 3.1.0
@@ -8,2 +8,3 @@ export * from './errors'; | ||
export * from './date'; | ||
export * from './discriminated-union'; | ||
export * from './enumerate'; | ||
@@ -10,0 +11,0 @@ export * from './map-object-keys'; |
@@ -20,2 +20,3 @@ "use strict"; | ||
__exportStar(require("./date"), exports); | ||
__exportStar(require("./discriminated-union"), exports); | ||
__exportStar(require("./enumerate"), exports); | ||
@@ -22,0 +23,0 @@ __exportStar(require("./map-object-keys"), exports); |
{ | ||
"name": "fefe", | ||
"version": "3.0.0", | ||
"version": "3.1.0", | ||
"description": "Validate, sanitize and transform values with proper types.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -223,2 +223,12 @@ # fefe | ||
### `discriminatedUnion(key, definition, options?): Validator<ObjectResult<D>>` | ||
Returns a validator that returns `value` if: | ||
* it is an object and | ||
* the `value[key]` is a key of `definition` | ||
* `value` (without `key`) passes the validation as specified in `definition[key]`. | ||
Otherwise it returns an error. A new object is returned that has the results of the validator functions as values. | ||
Options: see `object()`. | ||
### `enumerate(value1, value2, ...): Validator<value1 | value2 | ...>` | ||
@@ -225,0 +235,0 @@ |
Sorry, the diff of this file is not supported yet
55988
64
615
316