MCPcopy Create free account
hub / github.com/github/awesome-copilot / safeFileOperation

Function safeFileOperation

eng/yaml-parser.mjs:8–15  ·  view source on GitHub ↗
(operation, filePath, defaultValue = null)

Source from the content-addressed store, hash-verified

6import { matter } from "vfile-matter";
7
8function 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

Callers 5

parseFrontmatterFunction · 0.70
parseSkillMetadataFunction · 0.70
parseHookMetadataFunction · 0.70
parseWorkflowMetadataFunction · 0.70
parseYamlFileFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected