@deloittesolutions/joi-color-extensions
v1.0.0
Published
> JOI extension to validate colors
Downloads
7
Keywords
Readme
joi-color-extensions
JOI extension to validate colors
Install
Install the profile with npm
:
npm i -S joi @deloittesolutions/joi-color-extensions
Usage
HEX Code
Validate hex codes:
const joi = require('joi');
const color = require('@deloittesolutions/joi-color-extensions');
const schema = joi.object().keys({
code: color.hexCode().valid(),
});
const data = {code: '#ffffff'};
const result = joi.validate(data, schema);
// result.value = {code: '#ffffff'}