File tree Expand file tree Collapse file tree 1 file changed +8
-12
lines changed Expand file tree Collapse file tree 1 file changed +8
-12
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,11 @@ type t = {
77
88let decode = json => {
99 open JSON
10+ let optionToNull = opt =>
11+ switch opt {
12+ | Some (String (v )) => Null .Value (v )
13+ | _ => Null
14+ }
1015 switch json {
1116 | Object (dict {
1217 "title" : String (title ),
@@ -16,18 +21,9 @@ let decode = json => {
1621 }) =>
1722 Some ({
1823 title ,
19- metaTitle : switch metaTitle {
20- | Some (String (v )) => Null .Value (v )
21- | _ => Null .Null
22- },
23- description : switch description {
24- | Some (String (v )) => Null .Value (v )
25- | _ => Null .Null
26- },
27- canonical : switch canonical {
28- | Some (String (v )) => Null .Value (v )
29- | _ => Null .Null
30- },
24+ metaTitle : metaTitle -> optionToNull ,
25+ description : description -> optionToNull ,
26+ canonical : canonical -> optionToNull ,
3127 })
3228 | _ => None
3329 }
You can’t perform that action at this time.
0 commit comments