All files / src/helpers format-matter.ts

100% Statements 7/7
100% Branches 5/5
100% Functions 2/2
100% Lines 7/7
1 2 3 4 5 6 7 8 9 10 11 12  2x   3x 6x 6x 2x     3x   2x
export function formatMatter<
  C extends {data: {[prop: string]: object | string}}
>(ctx: C): C {
  Object.keys(ctx.data).forEach(item => {
    const target = ctx.data[item];
    if ((item !== 'NOTE' && typeof target !== 'object') || target === null) {
      ctx.data[item] = {default: target};
    }
  });
  return ctx;
}