UNPKG

459 BJavaScriptView Raw
1/* global window */
2var defaultDepth = 3;
3var matchDepthParameter =
4 typeof window !== 'undefined' &&
5 typeof window.location !== 'undefined' &&
6 window.location.search.match(/[?&]depth=(\d+)(?:$|&)/);
7
8if (matchDepthParameter) {
9 defaultDepth = parseInt(matchDepthParameter[1], 10);
10} else if (typeof process !== 'undefined' && process.env.UNEXPECTED_DEPTH) {
11 defaultDepth = parseInt(process.env.UNEXPECTED_DEPTH, 10);
12}
13module.exports = defaultDepth;