(operation, filePath, defaultValue = null)
| 6 | import { matter } from "vfile-matter"; |
| 7 | |
| 8 | function safeFileOperation(operation, filePath, defaultValue = null) { |
| 9 | try { |
| 10 | return operation(); |
| 11 | } catch (error) { |
| 12 | console.error(`Error processing file ${filePath}: ${error.message}`); |
| 13 | return defaultValue; |
| 14 | } |
| 15 | } |
| 16 | |
| 17 | /** |
| 18 | * Parse frontmatter from a markdown file using vfile-matter |
no outgoing calls
no test coverage detected