Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

find-up

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

find-up - npm Package Compare versions

Comparing version 2.1.0 to 3.0.0

16

index.js

@@ -5,7 +5,5 @@ 'use strict';

module.exports = (filename, opts) => {
opts = opts || {};
module.exports = (filename, opts = {}) => {
const startDir = path.resolve(opts.cwd || '');
const root = path.parse(startDir).root;
const {root} = path.parse(startDir);

@@ -29,7 +27,5 @@ const filenames = [].concat(filename);

module.exports.sync = (filename, opts) => {
opts = opts || {};
module.exports.sync = (filename, opts = {}) => {
let dir = path.resolve(opts.cwd || '');
const root = path.parse(dir).root;
const {root} = path.parse(dir);

@@ -44,3 +40,5 @@ const filenames = [].concat(filename);

return path.join(dir, file);
} else if (dir === root) {
}
if (dir === root) {
return null;

@@ -47,0 +45,0 @@ }

{
"name": "find-up",
"version": "2.1.0",
"description": "Find a file by walking up parent directories",
"license": "MIT",
"repository": "sindresorhus/find-up",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=4"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
"find",
"up",
"find-up",
"findup",
"look-up",
"look",
"file",
"search",
"match",
"package",
"resolve",
"parent",
"parents",
"folder",
"directory",
"dir",
"walk",
"walking",
"path"
],
"dependencies": {
"locate-path": "^2.0.0"
},
"devDependencies": {
"ava": "*",
"tempfile": "^1.1.1",
"xo": "*"
},
"xo": {
"esnext": true
}
"name": "find-up",
"version": "3.0.0",
"description": "Find a file or directory by walking up parent directories",
"license": "MIT",
"repository": "sindresorhus/find-up",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=6"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
"find",
"up",
"find-up",
"findup",
"look-up",
"look",
"file",
"search",
"match",
"package",
"resolve",
"parent",
"parents",
"folder",
"directory",
"dir",
"walk",
"walking",
"path"
],
"dependencies": {
"locate-path": "^3.0.0"
},
"devDependencies": {
"ava": "*",
"tempy": "^0.2.1",
"xo": "*"
}
}
# find-up [![Build Status: Linux and macOS](https://travis-ci.org/sindresorhus/find-up.svg?branch=master)](https://travis-ci.org/sindresorhus/find-up) [![Build Status: Windows](https://ci.appveyor.com/api/projects/status/l0cyjmvh5lq72vq2/branch/master?svg=true)](https://ci.appveyor.com/project/sindresorhus/find-up/branch/master)
> Find a file by walking up parent directories
> Find a file or directory by walking up parent directories

@@ -9,3 +9,3 @@

```
$ npm install --save find-up
$ npm install find-up
```

@@ -27,15 +27,14 @@

`example.js`
```js
// example.js
const findUp = require('find-up');
findUp('unicorn.png').then(filepath => {
console.log(filepath);
(async () => {
console.log(await findUp('unicorn.png'));
//=> '/Users/sindresorhus/unicorn.png'
});
findUp(['rainbow.png', 'unicorn.png']).then(filepath => {
console.log(filepath);
console.log(await findUp(['rainbow.png', 'unicorn.png']));
//=> '/Users/sindresorhus/unicorn.png'
});
})();
```

@@ -48,7 +47,7 @@

Returns a `Promise` for the filepath or `null`.
Returns a `Promise` for either the filepath or `null` if it couldn't be found.
### findUp([filenameA, filenameB], [options])
Returns a `Promise` for the first filepath found (by respecting the order) or `null`.
Returns a `Promise` for either the first filepath found (by respecting the order) or `null` if none could be found.

@@ -71,2 +70,4 @@ ### findUp.sync(filename, [options])

Type: `Object`
##### cwd

@@ -85,2 +86,3 @@

- [pkg-dir](https://github.com/sindresorhus/pkg-dir) - Find the root directory of an npm package
- [resolve-from](https://github.com/sindresorhus/resolve-from) - Resolve the path of a module like `require.resolve()` but from a given path

@@ -87,0 +89,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc