1 |
|
2 |
|
3 |
|
4 | const bedrock = require('bedrock');
|
5 |
|
6 | const schema = {
|
7 | title: 'Person Name',
|
8 | description: 'The name of a person.',
|
9 | type: 'string',
|
10 | pattern: '^\\S$|^\\S.*\\S$',
|
11 | minLength: 1,
|
12 | maxLength: 100,
|
13 | errors: {
|
14 | invalid: 'The name must not start or end with whitespace and must ' +
|
15 | 'be between 1 and 100 characters in length.',
|
16 | missing: 'Please enter a name.'
|
17 | }
|
18 | };
|
19 |
|
20 | module.exports = function(extend) {
|
21 | if(extend) {
|
22 | return bedrock.util.extend(true, bedrock.util.clone(schema), extend);
|
23 | }
|
24 | return schema;
|
25 | };
|