1 | const utils = require('./utils');
|
2 |
|
3 | let defaultDepth = 3;
|
4 | const matchDepthParameter =
|
5 | typeof window !== 'undefined' &&
|
6 | typeof window.location !== 'undefined' &&
|
7 | window.location.search.match(/[?&]depth=(\d+)(?:$|&)/);
|
8 |
|
9 | if (matchDepthParameter) {
|
10 | defaultDepth = parseInt(matchDepthParameter[1], 10);
|
11 | } else {
|
12 | const defaultDepthFromEnv = utils.getEnv('UNEXPECTED_DEPTH');
|
13 | if (defaultDepthFromEnv) {
|
14 | defaultDepth = parseInt(defaultDepthFromEnv, 10);
|
15 | }
|
16 | }
|
17 | module.exports = defaultDepth;
|