1.9.8 • Published 2 years ago

@guanghechen/locate-helper v1.9.8

Weekly downloads
388
License
MIT
Repository
github
Last release
2 years ago

Utils for locate nearest filepath matched the given pattern.

Install

  • npm

    npm install --save @guanghechen/locate-helper
  • yarn

    yarn add @guanghechen/locate-helper

Usage

locateNearestFilepath

export function locateNearestFilepath(
  currentDir: string,
  filenames: string[],
): string | null

Locate a nearest filepath from the given currentDir which name included in the give filenames.

  • currentDir: The starting directory of the locating.

  • filenames: The file name list of the file to be searched, the first existed filepath in the list will be returned as the result.

findNearestFilepath

export function findNearestFilepath(
  currentDir: string,
  testFilepath: (filepath: string) => boolean,
): string | null

Find a nearest filepath from the give currentDirwhich matched the give tester testFilepath.

  • currentDir: The starting directory of the searching.

  • testFilepath: Test if a given filepath is an expected one.

locateLatestPackageJson

export function locateLatestPackageJson(currentDir: string): string | null

Find the latest package.json under the give currentDir or its ancestor path.

  • currentDir: The starting directory of the locating.
1.9.8

2 years ago

1.9.7

2 years ago

1.9.6

2 years ago

1.9.5

2 years ago

1.9.4

2 years ago

1.9.3

2 years ago

1.9.2

2 years ago

1.9.0-alpha.0

2 years ago

1.9.1

2 years ago

1.9.0

2 years ago

1.8.6

2 years ago

1.8.5

2 years ago

1.8.4

3 years ago

1.8.3

3 years ago

1.8.2

3 years ago

1.8.1

3 years ago

1.8.0

3 years ago

1.7.1

3 years ago

1.7.0

3 years ago

1.7.0-alpha.3

3 years ago

1.7.0-alpha.1

3 years ago

1.7.0-alpha.2

3 years ago

1.7.0-alpha.0

3 years ago

1.6.1

3 years ago

1.6.0

3 years ago

1.5.5

3 years ago

1.5.4

3 years ago

1.5.3

3 years ago

1.5.2

3 years ago

1.5.1

3 years ago

1.5.0

3 years ago

1.4.1

3 years ago

1.4.0

3 years ago

1.3.1

3 years ago

1.3.0

3 years ago

1.2.1

3 years ago

1.2.0

3 years ago

1.1.0

3 years ago

1.0.13

3 years ago

1.0.11

3 years ago

1.0.12

3 years ago

1.0.10

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago