feat: refactoring project

This commit is contained in:
Carlos
2024-11-23 14:56:07 -05:00
parent f0c2a50c18
commit 1c6db5818d
2351 changed files with 39323 additions and 60326 deletions

120
node_modules/find-up/readme.md generated vendored
View File

@@ -1,14 +1,12 @@
# find-up [![Build Status](https://travis-ci.org/sindresorhus/find-up.svg?branch=master)](https://travis-ci.org/sindresorhus/find-up)
# find-up
> Find a file or directory by walking up parent directories
## Install
```sh
npm install find-up
```
$ npm install find-up
```
## Usage
@@ -26,50 +24,65 @@ $ npm install find-up
`example.js`
```js
const path = require('path');
const findUp = require('find-up');
import path from 'node:path';
import {findUp, pathExists} from 'find-up';
(async () => {
console.log(await findUp('unicorn.png'));
//=> '/Users/sindresorhus/unicorn.png'
console.log(await findUp('unicorn.png'));
//=> '/Users/sindresorhus/unicorn.png'
console.log(await findUp(['rainbow.png', 'unicorn.png']));
//=> '/Users/sindresorhus/unicorn.png'
console.log(await findUp(['rainbow.png', 'unicorn.png']));
//=> '/Users/sindresorhus/unicorn.png'
console.log(await findUp(async directory => {
const hasUnicorns = await findUp.exists(path.join(directory, 'unicorn.png'));
return hasUnicorns && directory;
}, {type: 'directory'}));
//=> '/Users/sindresorhus'
})();
console.log(await findUp(async directory => {
const hasUnicorns = await pathExists(path.join(directory, 'unicorn.png'));
return hasUnicorns && directory;
}, {type: 'directory'}));
//=> '/Users/sindresorhus'
```
## API
### findUp(name, options?)
### findUp(matcher, options?)
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.
### findUp([...name], options?)
Returns a `Promise` for either the first path found (by respecting the order of the array) or `undefined` if none could be found.
### findUp.sync(name, options?)
### findUp.sync(matcher, options?)
### findUpMultiple(name, options?)
### findUpMultiple(matcher, options?)
Returns a path or `undefined` if it couldn't be found.
Returns a `Promise` for either an array of paths or an empty array if none could be found.
### findUp.sync([...name], options?)
### findUpMultiple([...name], options?)
Returns a `Promise` for either an array of the first paths found (by respecting the order of the array) or an empty array if none could be found.
### findUpSync(name, options?)
### findUpSync(matcher, options?)
Returns a path or `undefined` if it could not be found.
### findUpSync([...name], options?)
Returns the first path found (by respecting the order of the array) or `undefined` if none could be found.
### findUpMultipleSync(name, options?)
### findUpMultipleSync(matcher, options?)
Returns an array of paths or an empty array if none could be found.
### findUpMultipleSync([...name], options?)
Returns an array of the first paths found (by respecting the order of the array) or an empty array if none could be found.
#### name
Type: `string`
Name of the file or directory to find.
The name of the file or directory to find.
#### matcher
@@ -85,31 +98,38 @@ Type: `object`
##### cwd
Type: `string`<br>
Type: `URL | string`\
Default: `process.cwd()`
Directory to start from.
The directory to start from.
##### type
Type: `string`<br>
Default: `'file'`<br>
Values: `'file'` `'directory'`
Type: `string`\
Default: `'file'`\
Values: `'file' | 'directory'`
The type of paths that can match.
The type of path to match.
##### allowSymlinks
Type: `boolean`<br>
Type: `boolean`\
Default: `true`
Allow symbolic links to match if they point to the chosen path type.
### findUp.exists(path)
##### stopAt
Type: `URL | string`\
Default: Root directory
A directory path where the search halts if no matches are found before reaching this point.
### pathExists(path)
Returns a `Promise<boolean>` of whether the path exists.
### findUp.sync.exists(path)
### pathExistsSync(path)
Returns a `boolean` of whether the path exists.
@@ -117,40 +137,24 @@ Returns a `boolean` of whether the path exists.
Type: `string`
Path to a file or directory.
The path to a file or directory.
### findUp.stop
### findUpStop
A [`Symbol`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol) that can be returned by a `matcher` function to stop the search and cause `findUp` to immediately return `undefined`. Useful as a performance optimization in case the current working directory is deeply nested in the filesystem.
```js
const path = require('path');
const findUp = require('find-up');
import path from 'node:path';
import {findUp, findUpStop} from 'find-up';
(async () => {
await findUp(directory => {
return path.basename(directory) === 'work' ? findUp.stop : 'logo.png';
});
})();
await findUp(directory => {
return path.basename(directory) === 'work' ? findUpStop : 'logo.png';
});
```
## Related
- [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>