We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi quick question, I'm wondering if it's possible to have custom formats in the array for example:
format: ['my-custom-added-format-1', 'my-custom-added-format-2'],
It seems to expect a string when I try and do this! (I've added the custom formats via the addFormat method)
The text was updated successfully, but these errors were encountered:
Actually, a format array is for a whitelist of value, like : format: ['value1', 'value2'].
format: ['value1', 'value2']
But you can make your own format to do :
format: 'several', formats: ['my-custom-added-format-1', 'my-custom-added-format-2']
convict.addFormat('several', function (value, schema) { for (formatExpected in schema.formats) { const conf = convict({ val: { format: formatExpected } }).load({ val: value }).validate(); try { conf.validate(); return true; } catch { } }); throw new Error('invalid'); });
Sorry, something went wrong.
No branches or pull requests
Hi quick question, I'm wondering if it's possible to have custom formats in the array for example:
format: ['my-custom-added-format-1', 'my-custom-added-format-2'],
It seems to expect a string when I try and do this! (I've added the custom formats via the addFormat method)
The text was updated successfully, but these errors were encountered: