@rainbowatcher/path-extra
Advanced tools
| /** | ||
| * Normalizes a given file path to a consistent format. | ||
| * | ||
| * @example | ||
| * ```js | ||
| * normalize("C:\\current\\working\\directory") | ||
| * // "C:/current/working/directory" | ||
| * normalize("/current\\working//directory") | ||
| * // "/current/working/directory" | ||
| * ``` | ||
| * | ||
| * ref: <https://github.com/lint-staged/lint-staged/blob/master/lib/normalizePath.js> | ||
| * @param inputPath - the path to be normalized | ||
| * @return the normalized path | ||
| */ | ||
| declare function normalize(inputPath: string): string; | ||
| /** | ||
| * Returns the absolute path of the given input path. | ||
| * | ||
| * @param inputPath - the path to be converted to absolute | ||
| * @param cwd - the current working directory | ||
| * @return the absolute path | ||
| */ | ||
| declare function toAbsolute(inputPath: string, cwd?: string): string; | ||
| export { normalize, toAbsolute }; |
| import e from"node:path";var t="\\\\?\\",i="\\\\.\\";function p(r){if(!r)return r;if(r===e.posix.sep||r===e.win32.sep)return e.posix.sep;let o=r.replaceAll(/[/\\]+/g,"/");return(r.startsWith(t)||r.startsWith(i))&&(o=o.replace(/^\/(\.|\?)/,"//$1")),o.endsWith(e.posix.sep)&&(o=o.slice(0,-1)),o}var s=p;import m from"node:path";import l from"node:process";function n(r,o=l.cwd()){if(l.platform!=="win32"&&/^[a-z]:/i.test(r?.slice(0,2)))return s(r);let f=m.isAbsolute(r)?r:m.join(o,r);return s(f)}var c=n;export{s as normalize,c as toAbsolute}; |
+10
-3
| { | ||
| "name": "@rainbowatcher/path-extra", | ||
| "version": "0.2.1", | ||
| "type": "module", | ||
| "version": "0.2.2", | ||
| "description": "path extra utils", | ||
@@ -10,4 +11,10 @@ "author": "rainbowatcher <rainbow-w@outlook.com>", | ||
| ], | ||
| "main": "dist/index.js", | ||
| "types": "dist/index.d.ts", | ||
| "exports": { | ||
| ".": { | ||
| "types": "./dist/index.d.ts" | ||
| } | ||
| }, | ||
| "main": "./dist/index.js", | ||
| "module": "./dist/index.js", | ||
| "types": "./dist/index.d.ts", | ||
| "files": [ | ||
@@ -14,0 +21,0 @@ "dist" |
| /** | ||
| * Returns the absolute path of the given input path. | ||
| * | ||
| * @param inputPath - the path to be converted to absolute | ||
| * @param cwd - the current working directory | ||
| * @return the absolute path | ||
| */ | ||
| declare function toAbsolute(inputPath: string, cwd?: string): string; | ||
| /** | ||
| * Normalizes a given file path to a consistent format. | ||
| * | ||
| * @example | ||
| * ```js | ||
| * normalize("C:\\current\\working\\directory") | ||
| * // "C:/current/working/directory" | ||
| * normalize("/current\\working//directory") | ||
| * // "/current/working/directory" | ||
| * ``` | ||
| * | ||
| * ref: <https://github.com/lint-staged/lint-staged/blob/master/lib/normalizePath.js> | ||
| * @param inputPath - the path to be normalized | ||
| * @return the normalized path | ||
| */ | ||
| declare function normalize(inputPath: string): string; | ||
| export { normalize, toAbsolute }; |
| import o from"node:path";import t from"node:process";var s="\\\\?\\",i="\\\\.\\";function I(r,e=t.cwd()){if(t.platform!=="win32"&&/^[a-z]:/i.test(r?.slice(0,2)))return l(r);let c=o.isAbsolute(r)?r:o.join(e,r);return l(c)}function l(r){if(!r)return r;if(r===o.posix.sep||r===o.win32.sep)return o.posix.sep;let e=r.replaceAll(/[/\\]+/g,"/");return(r.startsWith(s)||r.startsWith(i))&&(e=e.replace(/^\/(\.|\?)/,"//$1")),e.endsWith(o.posix.sep)&&(e=e.slice(0,-1)),e}export{l as normalize,I as toAbsolute}; |
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
2858
6.28%28
1300%0
-100%Yes
NaN