@waiting/shared-core
Advanced tools
Comparing version 20.2.0 to 20.3.0
@@ -8,3 +8,3 @@ import { Observable } from 'rxjs'; | ||
export declare function readFileLineRx(path: string): Observable<string>; | ||
export declare function genAbsolutePath(path: string): string; | ||
export declare function genAbsolutePath(path: string, fileUrlPrefix?: boolean): string; | ||
//# sourceMappingURL=file.d.ts.map |
@@ -34,4 +34,15 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ | ||
} | ||
export function genAbsolutePath(path) { | ||
export function genAbsolutePath(path, fileUrlPrefix = false) { | ||
assert(path, 'path is empty'); | ||
if (path.startsWith('file://') && fileUrlPrefix) { | ||
return path; | ||
} | ||
const path2 = _genAbsolutePath(path); | ||
const ret = fileUrlPrefix | ||
? path2.startsWith('file://') ? path2 : `file://${path2}` | ||
: path2; | ||
return ret; | ||
} | ||
function _genAbsolutePath(path) { | ||
assert(path, 'path is empty'); | ||
if (isAbsolute(path)) { | ||
@@ -38,0 +49,0 @@ return path; |
{ | ||
"name": "@waiting/shared-core", | ||
"author": "waiting", | ||
"version": "20.2.0", | ||
"version": "20.3.0", | ||
"description": "node core function re export with Promise or Observable", | ||
@@ -70,3 +70,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "29a16033633f6d2de6e62deed11e96a76a1a0508" | ||
"gitHead": "726a2519e9853e0dcd5fbf62249c573fd3790229" | ||
} |
@@ -45,5 +45,18 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ | ||
export function genAbsolutePath(path: string): string { | ||
export function genAbsolutePath(path: string, fileUrlPrefix = false): string { | ||
assert(path, 'path is empty') | ||
if (path.startsWith('file://') && fileUrlPrefix) { | ||
return path | ||
} | ||
const path2 = _genAbsolutePath(path) | ||
const ret = fileUrlPrefix | ||
? path2.startsWith('file://') ? path2 : `file://${path2}` | ||
: path2 | ||
return ret | ||
} | ||
function _genAbsolutePath(path: string): string { | ||
assert(path, 'path is empty') | ||
if (isAbsolute(path)) { | ||
@@ -50,0 +63,0 @@ return path |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
146143
2834