UNPKG

609 BJavaScriptView Raw
1/*!
2 * Copyright (c) 2012-2018 Digital Bazaar, Inc. All rights reserved.
3 */
4const bedrock = require('bedrock');
5
6const 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
20module.exports = function(extend) {
21 if(extend) {
22 return bedrock.util.extend(true, bedrock.util.clone(schema), extend);
23 }
24 return schema;
25};