codeql-action/node_modules/ava/node_modules/globby/to-path.js
2022-02-01 18:56:42 +00:00

15 lines
288 B
JavaScript

import {fileURLToPath} from 'node:url';
const toPath = urlOrPath => {
if (!urlOrPath) {
return urlOrPath;
}
if (urlOrPath instanceof URL) {
urlOrPath = urlOrPath.href;
}
return urlOrPath.startsWith('file://') ? fileURLToPath(urlOrPath) : urlOrPath;
};
export default toPath;