/
githubmirror
/
nest
Обзор
Документация
Войти
/
githubmirror
/
nest
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
tools/gulp/util/task-helpers.ts
23 строки
647 B
Lioness100
docs: fix typos
11 фев 2023, 05:39
11 фев 2023, 05:39
fda5fff
Код
Авторство
О чём код?
import { readdirSync, statSync } from 'fs'; import { join } from 'path'; function isDirectory(path: string) { return statSync(path).isDirectory(); } export function getFolders(dir: string) { return readdirSync(dir).filter(file => isDirectory(join(dir, file))); } export function getDirs(base: string) { return getFolders(base).map(path => `${base}/${path}`); } /** * Checks if the directory contains a package.json file * @param dir Path to the directory * @returns True if the directory contains a package.json */ export function containsPackageJson(dir: string) { return readdirSync(dir).some(file => file === 'package.json'); }