2016-09-11 23:08:18 +02:00
|
|
|
import YAML from './yaml';
|
2016-02-25 20:40:35 -08:00
|
|
|
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;
|
|
|
|
}
|
2016-02-25 20:40:35 -08:00
|
|
|
}
|