API reference
seniority/find-up
Every export of seniority/find-up, with its signature and doc comment: findUpSync, findUpMultipleSync, findUp, findUpMultiple, plus 1 type.
import { findUpSync, findUpMultipleSync, findUp, … } from 'seniority/find-up';Functions
findUp
The async spellings, which are the ones find-up itself publishes.
They are async over a synchronous body on purpose. fs.existsSync in a bounded loop is
faster than the promise machinery for a walk this short — and a program that migrated from
find-up awaits these, so the signature has to match even where the work does not need it.
function findUp(name: string | readonly string[], options: FindUpOptions): Promise<string | undefined>;| Parameter | Type |
|---|---|
name | string | readonly string[] |
options | FindUpOptions |
Returns Promise<string \| undefined>
findUpMultiple
function findUpMultiple(name: string | readonly string[], options: FindUpOptions): Promise<string[]>;| Parameter | Type |
|---|---|
name | string | readonly string[] |
options | FindUpOptions |
Returns Promise<string[]>
findUpMultipleSync
Every match on the way up, nearest first. find-up's findUpMultiple.
function findUpMultipleSync(name: string | readonly string[], options: FindUpOptions): string[];| Parameter | Type |
|---|---|
name | string | readonly string[] |
options | FindUpOptions |
Returns string[]
findUpSync
The nearest match walking up from cwd, or undefined. Proximity outranks the order of the names.
function findUpSync(name: string | readonly string[], options: FindUpOptions): string | undefined;| Parameter | Type |
|---|---|
name | string | readonly string[] |
options | FindUpOptions |
Returns string \| undefined
Interfaces
FindUpOptions
interface FindUpOptions {
/** Where to start. Defaults to the caller's own directory being passed in; there is no ambient cwd here (R11). */
cwd: string;
/** The highest directory to look in, inclusive. Defaults to the filesystem root. */
stopAt?: string;
}