(config)
| 15 | * dash==0.18.0. The previous versions just had url_base_pathname |
| 16 | */ |
| 17 | export function urlBase(config) { |
| 18 | const hasUrlBase = has('url_base_pathname', config); |
| 19 | const hasReqPrefix = has('requests_pathname_prefix', config); |
| 20 | if (type(config) !== 'Object' || (!hasUrlBase && !hasReqPrefix)) { |
| 21 | throw new Error( |
| 22 | ` |
| 23 | Trying to make an API request but neither |
| 24 | "url_base_pathname" nor "requests_pathname_prefix" |
| 25 | is in \`config\`. \`config\` is: `, |
| 26 | config |
| 27 | ); |
| 28 | } |
| 29 | |
| 30 | const base = hasReqPrefix |
| 31 | ? config.requests_pathname_prefix |
| 32 | : config.url_base_pathname; |
| 33 | |
| 34 | return base.charAt(base.length - 1) === '/' ? base : base + '/'; |
| 35 | } |
| 36 | |
| 37 | const propsChildren = ['props', 'children']; |
| 38 |
no test coverage detected
searching dependent graphs…