1 | /*
|
2 | Copyright © 2019 Andrew Powell
|
3 |
|
4 | This Source Code Form is subject to the terms of the Mozilla Public
|
5 | License, v. 2.0. If a copy of the MPL was not distributed with this
|
6 | file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
7 |
|
8 | The above copyright notice and this permission notice shall be
|
9 | included in all copies or substantial portions of this Source Code Form.
|
10 | */
|
11 | const Joi = require('@hapi/joi');
|
12 |
|
13 | const { number, object, string, validate } = Joi.bind();
|
14 |
|
15 | module.exports = {
|
16 | validate(options) {
|
17 | const keys = {
|
18 | blockSize: number(),
|
19 | bytes: number(),
|
20 | name: string()
|
21 | };
|
22 | const schema = object().keys(keys);
|
23 | const results = validate(options, schema);
|
24 |
|
25 | return results;
|
26 | }
|
27 | };
|