<commit_before>import frontmatter from 'front-matter';
import { IService, IApi } from '.';

const formatApi = (slug: string, data: any): IApi => {
  const document = frontmatter(data);

  return {
    //@ts-ignore
    ...document.attributes,
    body: document.body,
    slug,
    description: document.attributes.tagline,
    path: `/api-publiques/${slug}`,
  };
};

const formatServiceWithApis = (apis: IApi[]) => (
  slug: string,
  data: any
): IService => {
  const document = frontmatter(data);

  //@ts-ignore
  const matchingAPis = document.attributes.api.map(serviceApiTitle => {
    const match = apis.find(api => api.title === serviceApiTitle);
    if (!match) {
      throw new Error(
        `No matching API for : ${serviceApiTitle} - in service : ${slug}`
      );
    }
    return { title: match.title, path: match.path };
  });

  return {
    //@ts-ignore
    ...document.attributes,
    body: document.body,<commit_msg>add missing data from service object<commit_after>import frontmatter from 'front-matter';
import { IService, IApi } from '.';

const formatApi = (slug: string, data: any): IApi => {
  const document = frontmatter(data);

  return {
    //@ts-ignore
    ...document.attributes,
    body: document.body,
    slug,
    description: document.attributes.tagline,
    path: `/api-publiques/${slug}`,
  };
};

const formatServiceWithApis = (apis: IApi[]) => (
  slug: string,
  data: any
): IService => {
  const document = frontmatter(data);

  //@ts-ignore
  const matchingAPis = document.attributes.api.map(serviceApiTitle => {
    const match = apis.find(api => api.title === serviceApiTitle);
    if (!match) {
      throw new Error(
        `No matching API for : ${serviceApiTitle} - in service : ${slug}`
      );
    }

    return {
      slug: match.slug,
      title: match.title,
      path: match.path,
      tagline: match.tagline,
      uptime: match.uptime,
      owner: match.owner,
      is_open: match.is_open,
      logo: match.logo,
    };
  });

  return {
    //@ts-ignore
    ...document.attributes,
    body: document.body,
{'fraction_non_alphanumeric': 0.15055315055315055, 'fraction_numerical': 0.0, 'mean_word_length': 2.802559414990859, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3064881', 'n_tokens_mistral': 678, 'n_tokens_neox': 674, 'n_words': 160}