UNPKG

aoc-automation

Version:

Advent of Code tool to automate the repetitive parts of AoC.

16 lines (15 loc) 619 B
import fs from "fs"; import path from "path"; const getAllFiles = (location) => { const entities = fs.readdirSync(location, { withFileTypes: true }); const files = entities.filter((entity) => entity.isFile()).map((entity) => path.join(location, entity.name)).filter((file) => [".ts", ".js", ".mjs"].includes(path.parse(file).ext)); const dirs = entities.filter((entity) => entity.isDirectory()).map((entity) => entity.name); return [ ...files, ...dirs.map((dir) => getAllFiles(path.join(location, dir))).flat() ]; }; var getAllFiles_default = getAllFiles; export { getAllFiles_default as default };