1 | 'use strict';
|
2 |
|
3 | var assert = require('assert');
|
4 |
|
5 | module.exports = function verifyOptions (opts) {
|
6 | assert(
|
7 | typeof opts.expeditious === 'object' && opts.expeditious !== null,
|
8 | 'opts.expeditious must be an object containing valid expeditious options'
|
9 | );
|
10 |
|
11 | assert(
|
12 | !opts.shouldCache || typeof opts.shouldCache === 'function',
|
13 | 'opts.shouldCache should be a function if provided'
|
14 | );
|
15 |
|
16 | assert(
|
17 | !opts.genCacheKey || typeof opts.genCacheKey === 'function',
|
18 | 'opts.genCacheKey should be a function if provided'
|
19 | );
|
20 |
|
21 | assert(
|
22 | !opts.statusCodeExpires || typeof opts.statusCodeExpires === 'object',
|
23 | 'opts.statusCodeExpires should be an object if provided'
|
24 | );
|
25 |
|
26 | assert(
|
27 | opts.expeditious.isObjectMode() === true,
|
28 | 'opts.expeditious.objectMode should be set to true on the instance ' +
|
29 | 'provided to ' + require('../package.json').name
|
30 | );
|
31 | };
|