๐Ÿ“ฆ directus / cli

๐Ÿ“„ parsers.ts ยท 17 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17import yaml from 'js-yaml';
import JSON5 from 'json5';

export function parseJson(value: string): any {
	if (typeof value === 'undefined') {
		return undefined;
	}
	return JSON5.parse(value);
}

export function parseYaml(value: string): any {
	if (typeof value === 'undefined') {
		return undefined;
	}
	return yaml.load(value);
}