MCPcopy
hub / github.com/chavyleung/scripts / getPath

Function getPath

chavy.box.js:127–133  ·  view source on GitHub ↗

* http://boxjs.com/ => `` * http://boxjs.com/api/getdata => `/api/getdata`

(url)

Source from the content-addressed store, hash-verified

125 * http://boxjs.com/api/getdata => `/api/getdata`
126 */
127function 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 * ===================================

Callers 1

chavy.box.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…