locate-path
Advanced tools
Comparing version 7.0.0 to 7.1.0
@@ -7,3 +7,3 @@ export interface Options { | ||
*/ | ||
readonly cwd?: string; | ||
readonly cwd?: URL | string; | ||
@@ -10,0 +10,0 @@ /** |
import process from 'node:process'; | ||
import path from 'node:path'; | ||
import fs, {promises as fsPromises} from 'node:fs'; | ||
import {fileURLToPath} from 'node:url'; | ||
import pLocate from 'p-locate'; | ||
@@ -21,2 +22,4 @@ | ||
const toPath = urlOrPath => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath; | ||
export async function locatePath( | ||
@@ -33,2 +36,3 @@ paths, | ||
checkType(type); | ||
cwd = toPath(cwd); | ||
@@ -56,2 +60,3 @@ const statFunction = allowSymlinks ? fsPromises.stat : fsPromises.lstat; | ||
checkType(type); | ||
cwd = toPath(cwd); | ||
@@ -58,0 +63,0 @@ const statFunction = allowSymlinks ? fs.statSync : fs.lstatSync; |
{ | ||
"name": "locate-path", | ||
"version": "7.0.0", | ||
"version": "7.1.0", | ||
"description": "Get the first path that exists on disk of multiple paths", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -63,3 +63,3 @@ # locate-path | ||
Type: `string`\ | ||
Type: `URL | string`\ | ||
Default: `process.cwd()` | ||
@@ -84,3 +84,3 @@ | ||
### locatePath.sync(paths, options?) | ||
### locatePathSync(paths, options?) | ||
@@ -87,0 +87,0 @@ Returns the first path that exists or `undefined` if none exists. |
7172
130