Socket
Socket
Sign inDemoInstall

locate-path

Package Overview
Dependencies
3
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 1.1.0

21

index.js
'use strict';
const path = require('path');
const pathExists = require('path-exists');
const pLocate = require('p-locate');
module.exports = (iterable, opts) => pLocate(iterable, el => pathExists(el), opts);
module.exports = (iterable, opts) => {
opts = Object.assign({
cwd: process.cwd()
}, opts);
module.exports.sync = iterable => {
for (const x of iterable) {
if (pathExists.sync(x)) {
return x;
return pLocate(iterable, el => pathExists(path.resolve(opts.cwd, el)), opts);
};
module.exports.sync = (iterable, opts) => {
opts = Object.assign({
cwd: process.cwd()
}, opts);
for (const el of iterable) {
if (pathExists.sync(path.resolve(opts.cwd, el))) {
return el;
}
}
};
{
"name": "locate-path",
"version": "1.0.0",
"version": "1.1.0",
"description": "Get the first path that exists on disk of multiple paths",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -59,4 +59,11 @@ # locate-path [![Build Status](https://travis-ci.org/sindresorhus/locate-path.svg?branch=master)](https://travis-ci.org/sindresorhus/locate-path)

### locatePath.sync(input)
##### cwd
Type: `string`<br>
Default: `process.cwd()`
Current working directory.
### locatePath.sync(input, [options])
Returns the first path that exists or `undefined` if none exists.

@@ -70,3 +77,11 @@

#### options
Type: `Object`
##### cwd
Same as above.
## Related

@@ -73,0 +88,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc