Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const parseString = (string, filename, sourcePaths) => {
try {
const IncludeYamlType = includeYamlType(filename, sourcePaths)
const DataYamlType = dataYamlType(filename, sourcePaths)
const schema = yaml.Schema.create([IncludeYamlType, DataYamlType, MarkdownYamlType])
const json = true // duplicate keys in a mapping will override values rather than throwing an error
return yaml.safeLoad(string.trim(), { schema, filename, json })
} catch (err) {
throw new UiengineInputError(['Could not parse YAML!', markSample(string)], err)
}
}