Comparing version 1.1.2 to 1.2.0
@@ -26,4 +26,14 @@ interface SchemaObjFloat extends SchemaObjBase<number> { | ||
declare type SchemaObj = SchemaObjInteger | SchemaObjEnum | SchemaObjFloat | SchemaObjAny | SchemaObjString | SchemaObjBoolean; | ||
interface SchemaObjCustom extends SchemaObjBase<unknown> { | ||
format: 'custom'; | ||
validate?: (value: unknown) => boolean; | ||
coerce?: (value: unknown) => unknown; | ||
} | ||
interface SchemaObjArray extends SchemaObjBase<string[]> { | ||
format: 'array'; | ||
} | ||
declare type SchemaObj = SchemaObjInteger | SchemaObjEnum | SchemaObjFloat | SchemaObjAny | SchemaObjString | SchemaObjBoolean | SchemaObjCustom | SchemaObjArray; | ||
interface SchemaObjBase<T> { | ||
@@ -30,0 +40,0 @@ doc?: string; |
{ | ||
"name": "figue", | ||
"version": "1.1.2", | ||
"version": "1.2.0", | ||
"description": "Platform agnostic configuration management library, with environmental variables and validation, like convict", | ||
@@ -5,0 +5,0 @@ "funding": "https://github.com/sponsors/CorentinTh", |
@@ -307,2 +307,22 @@ # Figue | ||
<tr> | ||
<td>Custom</td> | ||
<td>You can define your own validation and coercion function</td> | ||
<td> | ||
```js | ||
{ | ||
foo: { | ||
doc: 'Array of things', | ||
format: 'custom', | ||
validate: (value) => _.isString(value) | ||
coerce: (value) => value.split('-') | ||
default: 'a-b-c', | ||
} | ||
} | ||
``` | ||
</td> | ||
</tr> | ||
<tr> | ||
<td>Any </td> | ||
@@ -309,0 +329,0 @@ <td>It can be anything</td> |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18388
314
368