0.2.9 • Published 6 years ago

@brillout/find v0.2.9

Weekly downloads
3
License
-
Repository
github
Last release
6 years ago

Find a file among your project files.

@brillout/find

Usage

find(filename)

  • filename: String. The name of the file you are looking for. It can as well be a directory.
  • returns: String. The path to the file or null.

The find function first collects all files with a name filename and then returns the collected file that is closest to the cwd (current working directory, i.e. process.cwd()).

The following files are explored:

  • All files (children only) of all directories between the cwd and the root (/).
  • All files (children and descendants) of the "project root directory".
    • A project root directory is a directory containing .git. The project root directory is found by considering all directories between the cwd and the root.
Example

Running

// /find/example/simple.js

const find = require('@brillout/find'); // npm install `@brillout/find`
console.log(find('pages/'));

prints

/home/brillout/code/@brillout/find/example/pages/
0.2.9

6 years ago

0.2.8

6 years ago

0.2.7

6 years ago

0.2.6

6 years ago

0.2.5

6 years ago

0.2.4

6 years ago

0.2.3

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago