UNPKG

unexpected

Version:
14 lines (12 loc) 459 B
/*global window*/ let defaultDepth = 3; const matchDepthParameter = typeof window !== 'undefined' && typeof window.location !== 'undefined' && window.location.search.match(/[?&]depth=(\d+)(?:$|&)/); if (matchDepthParameter) { defaultDepth = parseInt(matchDepthParameter[1], 10); } else if (typeof process !== 'undefined' && process.env.UNEXPECTED_DEPTH) { defaultDepth = parseInt(process.env.UNEXPECTED_DEPTH, 10); } module.exports = defaultDepth;