mirror of
https://github.com/anomalyco/opencode.git
synced 2026-05-04 23:40:48 +00:00
enterprise (#4617)
Co-authored-by: GitHub Action <action@github.com> Co-authored-by: Adam <2363879+adamdotdevin@users.noreply.github.com>
This commit is contained in:
parent
76192fbced
commit
49408c00e9
1205 changed files with 3057 additions and 1491 deletions
16
packages/util/src/path.ts
Normal file
16
packages/util/src/path.ts
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
export function getFilename(path: string) {
|
||||
if (!path) return ""
|
||||
const trimmed = path.replace(/[\/]+$/, "")
|
||||
const parts = trimmed.split("/")
|
||||
return parts[parts.length - 1] ?? ""
|
||||
}
|
||||
|
||||
export function getDirectory(path: string) {
|
||||
const parts = path.split("/")
|
||||
return parts.slice(0, parts.length - 1).join("/") + "/"
|
||||
}
|
||||
|
||||
export function getFileExtension(path: string) {
|
||||
const parts = path.split(".")
|
||||
return parts[parts.length - 1]
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue