mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-10 12:57:47 +00:00
[api] Fix GET /api/examples/list output (#6574)
A regression from #6554 caused the return value to contain a nested object with a `name` property for the `name` key of the response in the list.
This commit is contained in:
@@ -8,12 +8,13 @@ const exists = (path: string) => existsSync(path);
|
||||
const isDotFile = (name: string) => name.startsWith('.');
|
||||
const isDirectory = (path: string) => lstatSync(path).isDirectory();
|
||||
|
||||
export function summary(source: string) {
|
||||
export function summary(source: string): string[] {
|
||||
if (!exists(source) || !isDirectory(source)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return readdirSync(source, { withFileTypes: true })
|
||||
.filter(d => !isDotFile(d.name))
|
||||
.filter(d => d.isDirectory());
|
||||
.filter(d => d.isDirectory())
|
||||
.map(d => d.name);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user