CoolFace
Datasetpublic

basant307/AI_Governance_Project

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes48downloads
index.d.ts139 linesDownload Raw Back to find-up
1/* eslint-disable @typescript-eslint/unified-signatures */2import {Options as LocatePathOptions} from 'locate-path';3 4declare const stop: unique symbol;5 6declare namespace findUp {7	interface Options extends LocatePathOptions {}8 9	type StopSymbol = typeof stop;10 11	type Match = string | StopSymbol | undefined;12}13 14declare const findUp: {15	sync: {16		/**17		Synchronously check if a path exists.18 19		@param path - Path to the file or directory.20		@returns Whether the path exists.21 22		@example23		```24		import findUp = require('find-up');25 26		console.log(findUp.sync.exists('/Users/sindresorhus/unicorn.png'));27		//=> true28		```29		*/30		exists: (path: string) => boolean;31 32		/**33		Synchronously find a file or directory by walking up parent directories.34 35		@param name - Name of the file or directory to find. Can be multiple.36		@returns The first path found (by respecting the order of `name`s) or `undefined` if none could be found.37		*/38		(name: string | readonly string[], options?: findUp.Options): string | undefined;39 40		/**41		Synchronously find a file or directory by walking up parent directories.42 43		@param matcher - Called for each directory in the search. Return a path or `findUp.stop` to stop the search.44		@returns The first path found or `undefined` if none could be found.45 46		@example47		```48		import path = require('path');49		import findUp = require('find-up');50 51		console.log(findUp.sync(directory => {52			const hasUnicorns = findUp.sync.exists(path.join(directory, 'unicorn.png'));53			return hasUnicorns && directory;54		}, {type: 'directory'}));55		//=> '/Users/sindresorhus'56		```57		*/58		(matcher: (directory: string) => findUp.Match, options?: findUp.Options): string | undefined;59	};60 61	/**62	Check if a path exists.63 64	@param path - Path to a file or directory.65	@returns Whether the path exists.66 67	@example68	```69	import findUp = require('find-up');70 71	(async () => {72		console.log(await findUp.exists('/Users/sindresorhus/unicorn.png'));73		//=> true74	})();75	```76	*/77	exists: (path: string) => Promise<boolean>;78 79	/**80	Return this in a `matcher` function to stop the search and force `findUp` to immediately return `undefined`.81	*/82	readonly stop: findUp.StopSymbol;83 84	/**85	Find a file or directory by walking up parent directories.86 87	@param name - Name of the file or directory to find. Can be multiple.88	@returns The first path found (by respecting the order of `name`s) or `undefined` if none could be found.89 90	@example91	```92	// /93	// └── Users94	//     └── sindresorhus95	//         ├── unicorn.png96	//         └── foo97	//             └── bar98	//                 ├── baz99	//                 └── example.js100 101	// example.js102	import findUp = require('find-up');103 104	(async () => {105		console.log(await findUp('unicorn.png'));106		//=> '/Users/sindresorhus/unicorn.png'107 108		console.log(await findUp(['rainbow.png', 'unicorn.png']));109		//=> '/Users/sindresorhus/unicorn.png'110	})();111	```112	*/113	(name: string | readonly string[], options?: findUp.Options): Promise<string | undefined>;114 115	/**116	Find a file or directory by walking up parent directories.117 118	@param matcher - Called for each directory in the search. Return a path or `findUp.stop` to stop the search.119	@returns The first path found or `undefined` if none could be found.120 121	@example122	```123	import path = require('path');124	import findUp = require('find-up');125 126	(async () => {127		console.log(await findUp(async directory => {128			const hasUnicorns = await findUp.exists(path.join(directory, 'unicorn.png'));129			return hasUnicorns && directory;130		}, {type: 'directory'}));131		//=> '/Users/sindresorhus'132	})();133	```134	*/135	(matcher: (directory: string) => (findUp.Match | Promise<findUp.Match>), options?: findUp.Options): Promise<string | undefined>;136};137 138export = findUp;139 
basant307/AI_Governance_Project · CoolFace