/** * 分割path为数组 * * ```ts * import { splitPath } from 'sunny-js' * console.log(splitPath('path/to/somewhere')) * //=> ['path', 'to', 'somewhere'] * console.log(splitPath('blog/post/:id')) * //=> ['blog', 'post'] * console.log(splitPath('blog/post/:id/comment')) * //=> ['blog', 'post', 'comment'] * ``` * * @throws 如果没有有效path参数将会抛出 {@link TypeError} 异常 * @category 路径 */ export declare function splitPath(path: string | string[], sensitive?: boolean): string[]; /** * 根据深度定义,左起截取部分path片段 * * ```ts * import { cutPath } from 'sunny-js' * console.log(cutPath('/path/to/where', 2)) * // => '/path/to' * console.log(cutPath('/path/to/where', 1)) * // => '/path' * ``` * * @category 路径 */ export declare function cutPath(path: string, depth?: number): string; /** * 获取路径中basename部分 * * ```ts * import { basename } from 'sunny-js' * console.log(basename('/path/to/where')) * // => 'where' * ``` * * @see https://nodejs.org/api/path.html#pathbasenamepath-ext * @category 路径 */ export declare function basename(path: string): string; /** * 是否为相对路径 * @category 路径 */ export declare function isRelativePath(path: string): boolean; /** * 是否为绝对路径 * @category 路径 */ export declare function isAbsolutePath(path: string): boolean;