* http://boxjs.com/ => `` * http://boxjs.com/api/getdata => `/api/getdata`
(url)
| 125 | * http://boxjs.com/api/getdata => `/api/getdata` |
| 126 | */ |
| 127 | function getPath(url) { |
| 128 | // 如果以`/`结尾, 去掉最后一个`/` |
| 129 | const end = url.lastIndexOf('/') === url.length - 1 ? -1 : undefined |
| 130 | // slice第二个参数传 undefined 会直接截到最后 |
| 131 | // indexOf第二个参数用来跳过前面的 "https://" |
| 132 | return url.slice(url.indexOf('/', 8), end) |
| 133 | } |
| 134 | |
| 135 | /** |
| 136 | * =================================== |
no outgoing calls
no test coverage detected
searching dependent graphs…