Socket
Socket
Sign inDemoInstall

locate-path

Package Overview
Dependencies
4
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.0.0 to 4.0.0

index.d.ts

26

index.js

@@ -6,20 +6,22 @@ 'use strict';

module.exports = (iterable, options) => {
options = Object.assign({
cwd: process.cwd()
}, options);
module.exports = (paths, options) => {
options = {
cwd: process.cwd(),
...options
};
return pLocate(iterable, el => pathExists(path.resolve(options.cwd, el)), options);
return pLocate(paths, path_ => pathExists(path.resolve(options.cwd, path_)), options);
};
module.exports.sync = (iterable, options) => {
options = Object.assign({
cwd: process.cwd()
}, options);
module.exports.sync = (paths, options) => {
options = {
cwd: process.cwd(),
...options
};
for (const el of iterable) {
if (pathExists.sync(path.resolve(options.cwd, el))) {
return el;
for (const path_ of paths) {
if (pathExists.sync(path.resolve(options.cwd, path_))) {
return path_;
}
}
};
{
"name": "locate-path",
"version": "3.0.0",
"version": "4.0.0",
"description": "Get the first path that exists on disk of multiple paths",

@@ -13,9 +13,10 @@ "license": "MIT",

"engines": {
"node": ">=6"
"node": ">=8"
},
"scripts": {
"test": "xo && ava"
"test": "xo && ava && tsd"
},
"files": [
"index.js"
"index.js",
"index.d.ts"
],

@@ -38,9 +39,10 @@ "keywords": [

"dependencies": {
"p-locate": "^3.0.0",
"path-exists": "^3.0.0"
"p-locate": "^4.1.0",
"path-exists": "^4.0.0"
},
"devDependencies": {
"ava": "*",
"xo": "*"
"ava": "^1.4.1",
"tsd": "^0.7.2",
"xo": "^0.24.0"
}
}

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

### locatePath(input, [options])
### locatePath(paths, [options])
Returns a `Promise` for the first path that exists or `undefined` if none exists.
Returns a `Promise<string>` for the first path that exists or `undefined` if none exists.
#### input
#### paths

@@ -63,3 +63,3 @@ Type: `Iterable<string>`

Preserve `input` order when searching.
Preserve `paths` order when searching.

@@ -75,7 +75,7 @@ Disable this to improve performance if you don't care about the order.

### locatePath.sync(input, [options])
### locatePath.sync(paths, [options])
Returns the first path that exists or `undefined` if none exists.
#### input
#### paths

@@ -82,0 +82,0 @@ Type: `Iterable<string>`

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