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 2.0.0 to 3.0.0

16

index.js

@@ -6,17 +6,17 @@ 'use strict';

module.exports = (iterable, opts) => {
opts = Object.assign({
module.exports = (iterable, options) => {
options = Object.assign({
cwd: process.cwd()
}, opts);
}, options);
return pLocate(iterable, el => pathExists(path.resolve(opts.cwd, el)), opts);
return pLocate(iterable, el => pathExists(path.resolve(options.cwd, el)), options);
};
module.exports.sync = (iterable, opts) => {
opts = Object.assign({
module.exports.sync = (iterable, options) => {
options = Object.assign({
cwd: process.cwd()
}, opts);
}, options);
for (const el of iterable) {
if (pathExists.sync(path.resolve(opts.cwd, el))) {
if (pathExists.sync(path.resolve(options.cwd, el))) {
return el;

@@ -23,0 +23,0 @@ }

{
"name": "locate-path",
"version": "2.0.0",
"description": "Get the first path that exists on disk of multiple paths",
"license": "MIT",
"repository": "sindresorhus/locate-path",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=4"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
"locate",
"path",
"paths",
"file",
"files",
"exists",
"find",
"finder",
"search",
"searcher",
"array",
"iterable",
"iterator"
],
"dependencies": {
"p-locate": "^2.0.0",
"path-exists": "^3.0.0"
},
"devDependencies": {
"ava": "*",
"xo": "*"
},
"xo": {
"esnext": true
}
"name": "locate-path",
"version": "3.0.0",
"description": "Get the first path that exists on disk of multiple paths",
"license": "MIT",
"repository": "sindresorhus/locate-path",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=6"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
"locate",
"path",
"paths",
"file",
"files",
"exists",
"find",
"finder",
"search",
"searcher",
"array",
"iterable",
"iterator"
],
"dependencies": {
"p-locate": "^3.0.0",
"path-exists": "^3.0.0"
},
"devDependencies": {
"ava": "*",
"xo": "*"
}
}

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

```
$ npm install --save locate-path
$ npm install locate-path
```

@@ -23,10 +23,10 @@

'unicorn.png',
'rainbow.png', // only this one actually exists on disk
'rainbow.png', // Only this one actually exists on disk
'pony.png'
];
locatePath(files).then(foundPath => {
console.log(foundPath);
(async () => {
console(await locatePath(files));
//=> 'rainbow'
});
})();
```

@@ -33,0 +33,0 @@

Sorry, the diff of this file is not supported yet

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