egg_server/utils/pathTools.ts
zhaoyingbo 6e65581bbf
All checks were successful
Egg CI/CD / build-image (push) Successful in 32s
Egg CI/CD / deploy (push) Successful in 37s
feat: 接入lint 和 husky
2024-07-25 01:48:22 +00:00

13 lines
303 B
TypeScript

// 裁剪指定prefix路径
export function trimPathPrefix(path: string, prefix: string): string {
return path.startsWith(prefix) ? path.slice(prefix.length) : path
}
export const safeJsonStringify = (obj: any) => {
try {
return JSON.stringify(obj)
} catch (e) {
return String(obj)
}
}