Commit e7f87c4 1 parent aad6045 commit e7f87c4 Copy full SHA for e7f87c4
File tree 1 file changed +4
-2
lines changed
1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change 1
1
import matter from 'gray-matter' ;
2
2
import tomlFormatter from './toml' ;
3
3
import yamlFormatter from './yaml' ;
4
+ import jsonFormatter from './json' ;
4
5
5
6
const parsers = {
6
7
toml : input => tomlFormatter . fromFile ( null , input ) ,
7
- json : ( input ) => {
8
+ json : input => {
8
9
let JSONinput = input . trim ( ) ;
9
10
// Fix JSON if leading and trailing brackets were trimmed.
10
11
if ( JSONinput . substr ( 0 , 1 ) !== '{' ) {
@@ -13,8 +14,9 @@ const parsers = {
13
14
if ( JSONinput . substr ( - 1 ) !== '}' ) {
14
15
JSONinput = JSONinput + '}' ;
15
16
}
16
- return matter . engines . json . parse ( JSONinput ) ;
17
+ return jsonFormatter . fromFile ( null , JSONinput ) ;
17
18
} ,
19
+ yaml : input => yamlFormatter . fromFile ( null , input ) ,
18
20
}
19
21
20
22
function inferFrontmatterFormat ( str ) {
You can’t perform that action at this time.
0 commit comments