Socket
Socket
Sign inDemoInstall

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 6.3.0 to 7.0.0

11

index.d.ts

@@ -1,3 +0,2 @@

/* eslint-disable @typescript-eslint/unified-signatures */
import {Options as LocatePathOptions} from 'locate-path';
import {type Options as LocatePathOptions} from 'locate-path';

@@ -11,10 +10,10 @@ /**

export interface Options extends LocatePathOptions {
export type Options = {
/**
The path to the directory to stop the search before reaching root if there were no matches before the `stopAt` directory.
A directory path where the search halts if no matches are found before reaching this point.
@default path.parse(cwd).root
Default: Root directory
*/
readonly stopAt?: string;
}
} & LocatePathOptions;

@@ -21,0 +20,0 @@ /**

import path from 'node:path';
import {fileURLToPath} from 'node:url';
import {locatePath, locatePathSync} from 'locate-path';
import {toPath} from 'unicorn-magic';
const toPath = urlOrPath => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;
export const findUpStop = Symbol('findUpStop');
export async function findUpMultiple(name, options = {}) {
let directory = path.resolve(toPath(options.cwd) || '');
let directory = path.resolve(toPath(options.cwd) ?? '');
const {root} = path.parse(directory);
const stopAt = path.resolve(directory, options.stopAt || root);
const limit = options.limit || Number.POSITIVE_INFINITY;
const stopAt = path.resolve(directory, toPath(options.stopAt ?? root));
const limit = options.limit ?? Number.POSITIVE_INFINITY;
const paths = [name].flat();

@@ -54,6 +52,6 @@

export function findUpMultipleSync(name, options = {}) {
let directory = path.resolve(toPath(options.cwd) || '');
let directory = path.resolve(toPath(options.cwd) ?? '');
const {root} = path.parse(directory);
const stopAt = options.stopAt || root;
const limit = options.limit || Number.POSITIVE_INFINITY;
const stopAt = path.resolve(directory, toPath(options.stopAt) ?? root);
const limit = options.limit ?? Number.POSITIVE_INFINITY;
const paths = [name].flat();

@@ -60,0 +58,0 @@

{
"name": "find-up",
"version": "6.3.0",
"version": "7.0.0",
"description": "Find a file or directory by walking up parent directories",

@@ -14,5 +14,9 @@ "license": "MIT",

"type": "module",
"exports": "./index.js",
"exports": {
"types": "./index.d.ts",
"default": "./index.js"
},
"sideEffects": false,
"engines": {
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
"node": ">=18"
},

@@ -47,12 +51,13 @@ "scripts": {

"dependencies": {
"locate-path": "^7.1.0",
"path-exists": "^5.0.0"
"locate-path": "^7.2.0",
"path-exists": "^5.0.0",
"unicorn-magic": "^0.1.0"
},
"devDependencies": {
"ava": "^3.15.0",
"ava": "^5.3.1",
"is-path-inside": "^4.0.0",
"tempy": "^2.0.0",
"tsd": "^0.17.0",
"xo": "^0.44.0"
"tempy": "^3.1.0",
"tsd": "^0.29.0",
"xo": "^0.56.0"
}
}

@@ -7,5 +7,5 @@ # find-up

```sh
npm install find-up
```
$ npm install find-up
```

@@ -49,3 +49,3 @@ ## Usage

Returns a `Promise` for either the path or `undefined` if it couldn't be found.
Returns a `Promise` for either the path or `undefined` if it could not be found.

@@ -68,3 +68,3 @@ ### findUp([...name], options?)

Returns a path or `undefined` if it couldn't be found.
Returns a path or `undefined` if it could not be found.

@@ -113,5 +113,5 @@ ### findUpSync([...name], options?)

Default: `'file'`\
Values: `'file'` `'directory'`
Values: `'file' | 'directory'`
The type of paths that can match.
The type of path to match.

@@ -127,6 +127,6 @@ ##### allowSymlinks

Type: `string`\
Default: `path.parse(cwd).root`
Type: `URL | string`\
Default: Root directory
The path to the directory to stop the search before reaching root if there were no matches before the `stopAt` directory.
A directory path where the search halts if no matches are found before reaching this point.

@@ -163,16 +163,4 @@ ### pathExists(path)

- [find-up-cli](https://github.com/sindresorhus/find-up-cli) - CLI for this module
- [pkg-up](https://github.com/sindresorhus/pkg-up) - Find the closest package.json file
- [package-up](https://github.com/sindresorhus/package-up) - Find the closest package.json file
- [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
---
<div align="center">
<b>
<a href="https://tidelift.com/subscription/pkg/npm-find-up?utm_source=npm-find-up&utm_medium=referral&utm_campaign=readme">Get professional support for 'find-up' 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>
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