mirror of
https://github.com/thangisme/notes.git
synced 2024-11-01 01:37:37 -04: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;
|
|
};
|