1 | import {fileURLToPath} from 'node:url';
|
2 |
|
3 | const toPath = urlOrPath => {
|
4 | if (!urlOrPath) {
|
5 | return urlOrPath;
|
6 | }
|
7 |
|
8 | if (urlOrPath instanceof URL) {
|
9 | urlOrPath = urlOrPath.href;
|
10 | }
|
11 |
|
12 | return urlOrPath.startsWith('file://') ? fileURLToPath(urlOrPath) : urlOrPath;
|
13 | };
|
14 |
|
15 | export default toPath;
|