mirror of
https://github.com/thangisme/notes.git
synced 2024-11-09 16:17:22 -05:00
25 lines
526 B
JavaScript
25 lines
526 B
JavaScript
'use strict';
|
|
|
|
module.exports = function defFunc(ajv) {
|
|
if (ajv.RULES.keywords.patternRequired)
|
|
return console.warn('Keyword patternRequired is already defined');
|
|
|
|
defFunc.definition = {
|
|
type: 'object',
|
|
inline: require('./dotjs/patternRequired'),
|
|
statements: true,
|
|
errors: 'full',
|
|
metaSchema: {
|
|
type: 'array',
|
|
items: {
|
|
type: 'string',
|
|
format: 'regex'
|
|
},
|
|
uniqueItems: true
|
|
}
|
|
};
|
|
|
|
ajv.addKeyword('patternRequired', defFunc.definition);
|
|
return ajv;
|
|
};
|