UNPKG

vils

Version:

Recursively outputs file paths and contents in various formats

12 lines (10 loc) 433 B
import { IFormatter } from './Formatter'; import { FileEntry } from '../walker'; export class PlainFormatter implements IFormatter { format(entries: FileEntry[]): string { return entries.map(e => { if (typeof e.content === 'string') return `// ${e.relativePath}\n${e.content}`; return `// ${e.relativePath}\n<vils unable to read: ${e.content.error}>`; }).join('\n\n'); } }