aboutsummaryrefslogtreecommitdiff
path: root/sandbox/testAppNevena/Front/node_modules/@npmcli/git/lib/find.js
blob: d58f01dbcc16ff73a4fd1289045046dc26641ada (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
const is = require('./is.js')
const { dirname } = require('path')

module.exports = async ({ cwd = process.cwd() } = {}) => {
  if (await is({ cwd })) {
    return cwd
  }
  while (cwd !== dirname(cwd)) {
    cwd = dirname(cwd)
    if (await is({ cwd })) {
      return cwd
    }
  }
  return null
}