static-cms/src/formats/formats.js

16 lines
402 B
JavaScript
Raw Normal View History

2016-09-11 23:08:18 +02:00
import YAML from './yaml';
import YAMLFrontmatter from './yaml-frontmatter';
2016-09-11 23:08:18 +02:00
const yamlFormatter = new YAML();
const YamlFrontmatterFormatter = new YAMLFrontmatter();
2016-09-06 13:04:17 -03:00
export function resolveFormat(collectionOrEntity, entry) {
2016-09-11 23:08:18 +02:00
const extension = entry.path.split('.').pop();
switch (extension) {
case 'yml':
return yamlFormatter;
default:
return YamlFrontmatterFormatter;
}
}