locate-path
Advanced tools
Comparing version 5.0.0 to 6.0.0
@@ -46,2 +46,13 @@ declare namespace locatePath { | ||
/** | ||
Synchronously get the first path that exists on disk of multiple paths. | ||
@param paths - Paths to check. | ||
@returns The first path that exists or `undefined` if none exists. | ||
*/ | ||
sync: ( | ||
paths: Iterable<string>, | ||
options?: locatePath.Options | ||
) => string | undefined; | ||
/** | ||
Get the first path that exists on disk of multiple paths. | ||
@@ -69,17 +80,6 @@ | ||
(paths: Iterable<string>, options?: locatePath.AsyncOptions): Promise< | ||
string | undefined | ||
string | undefined | ||
>; | ||
/** | ||
Synchronously get the first path that exists on disk of multiple paths. | ||
@param paths - Paths to check. | ||
@returns The first path that exists or `undefined` if none exists. | ||
*/ | ||
sync( | ||
paths: Iterable<string>, | ||
options?: locatePath.Options | ||
): string | undefined; | ||
}; | ||
export = locatePath; |
@@ -32,3 +32,5 @@ 'use strict'; | ||
}; | ||
checkType(options); | ||
const statFn = options.allowSymlinks ? fsStat : fsLStat; | ||
@@ -40,3 +42,3 @@ | ||
return matchType(options.type, stat); | ||
} catch (_) { | ||
} catch { | ||
return false; | ||
@@ -54,3 +56,5 @@ } | ||
}; | ||
checkType(options); | ||
const statFn = options.allowSymlinks ? fs.statSync : fs.lstatSync; | ||
@@ -65,5 +69,4 @@ | ||
} | ||
} catch (_) { | ||
} | ||
} catch {} | ||
} | ||
}; |
{ | ||
"name": "locate-path", | ||
"version": "5.0.0", | ||
"version": "6.0.0", | ||
"description": "Get the first path that exists on disk of multiple paths", | ||
"license": "MIT", | ||
"repository": "sindresorhus/locate-path", | ||
"funding": "https://github.com/sponsors/sindresorhus", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "sindresorhus.com" | ||
"url": "https://sindresorhus.com" | ||
}, | ||
"engines": { | ||
"node": ">=8" | ||
"node": ">=10" | ||
}, | ||
@@ -38,9 +39,9 @@ "scripts": { | ||
"dependencies": { | ||
"p-locate": "^4.1.0" | ||
"p-locate": "^5.0.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "^1.4.1", | ||
"tsd": "^0.7.2", | ||
"xo": "^0.24.0" | ||
"ava": "^2.4.0", | ||
"tsd": "^0.13.1", | ||
"xo": "^0.32.1" | ||
} | ||
} |
@@ -1,6 +0,5 @@ | ||
# locate-path [![Build Status](https://travis-ci.org/sindresorhus/locate-path.svg?branch=master)](https://travis-ci.org/sindresorhus/locate-path) | ||
# locate-path [![Build Status](https://travis-ci.com/sindresorhus/locate-path.svg?branch=master)](https://travis-ci.com/github/sindresorhus/locate-path) | ||
> Get the first path that exists on disk of multiple paths | ||
## Install | ||
@@ -12,3 +11,2 @@ | ||
## Usage | ||
@@ -33,6 +31,5 @@ | ||
## API | ||
### locatePath(paths, [options]) | ||
### locatePath(paths, options?) | ||
@@ -49,8 +46,8 @@ Returns a `Promise<string>` for the first path that exists or `undefined` if none exists. | ||
Type: `Object` | ||
Type: `object` | ||
##### concurrency | ||
Type: `number`<br> | ||
Default: `Infinity`<br> | ||
Type: `number`\ | ||
Default: `Infinity`\ | ||
Minimum: `1` | ||
@@ -62,3 +59,3 @@ | ||
Type: `boolean`<br> | ||
Type: `boolean`\ | ||
Default: `true` | ||
@@ -72,3 +69,3 @@ | ||
Type: `string`<br> | ||
Type: `string`\ | ||
Default: `process.cwd()` | ||
@@ -80,5 +77,5 @@ | ||
Type: `string`<br> | ||
Default: `file`<br> | ||
Values: `file` `directory` | ||
Type: `string`\ | ||
Default: `'file'`\ | ||
Values: `'file' | 'directory'` | ||
@@ -89,3 +86,3 @@ The type of paths that can match. | ||
Type: `boolean`<br> | ||
Type: `boolean`\ | ||
Default: `true` | ||
@@ -95,3 +92,3 @@ | ||
### locatePath.sync(paths, [options]) | ||
### locatePath.sync(paths, options?) | ||
@@ -108,3 +105,3 @@ Returns the first path that exists or `undefined` if none exists. | ||
Type: `Object` | ||
Type: `object` | ||
@@ -123,3 +120,2 @@ ##### cwd | ||
## Related | ||
@@ -129,5 +125,12 @@ | ||
--- | ||
## License | ||
MIT © [Sindre Sorhus](https://sindresorhus.com) | ||
<div align="center"> | ||
<b> | ||
<a href="https://tidelift.com/subscription/pkg/npm-locate-path?utm_source=npm-locate-path&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a> | ||
</b> | ||
<br> | ||
<sub> | ||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies. | ||
</sub> | ||
</div> |
Sorry, the diff of this file is not supported yet
7017
126
119
+ Addedp-limit@3.1.0(transitive)
+ Addedp-locate@5.0.0(transitive)
+ Addedyocto-queue@0.1.0(transitive)
- Removedp-limit@2.3.0(transitive)
- Removedp-locate@4.1.0(transitive)
- Removedp-try@2.2.0(transitive)
Updatedp-locate@^5.0.0