<commit_before>/* eslint-disable no-underscore-dangle */
/* global window */

export const setJSONDoc = (jsondoc) => {
  window.__EMBER_GENERATED_DOC_JSON__ = jsondoc;
};
export const getJSONDoc = () => {
  return window.__EMBER_GENERATED_DOC_JSON__;
};

export const extractArgTypes = (componentName) => {
  const json = getJSONDoc();
  const componentDoc = json.included.find((doc) => doc.attributes.name === componentName);
  const rows = componentDoc.attributes.arguments.map((prop) => {
    return {
      name: prop.name,
      defaultValue: prop.defaultValue,
      description: prop.description,
      table: {
        type: {
          summary: prop.type,
          required: prop.tags.length ? prop.tags.some((tag) => tag.name === 'required') : false,
        },
      },
    };
  });
  return { rows };
};

export const extractComponentDescription = (componentName) => {
  const json = getJSONDoc();
  const componentDoc = json.included.find((doc) => doc.attributes.name === componentName);

  if (!componentDoc) {
    return '';
  }<commit_msg>Modified the return object of extractArgTypes in the ember framework to simply the list of rows instead of an object with a rows parameter<commit_after>/* eslint-disable no-underscore-dangle */
/* global window */

export const setJSONDoc = (jsondoc) => {
  window.__EMBER_GENERATED_DOC_JSON__ = jsondoc;
};
export const getJSONDoc = () => {
  return window.__EMBER_GENERATED_DOC_JSON__;
};

export const extractArgTypes = (componentName) => {
  const json = getJSONDoc();
  const componentDoc = json.included.find((doc) => doc.attributes.name === componentName);
  return componentDoc.attributes.arguments.map((prop) => {
    return {
      name: prop.name,
      defaultValue: prop.defaultValue,
      description: prop.description,
      table: {
        type: {
          summary: prop.type,
          required: prop.tags.length ? prop.tags.some((tag) => tag.name === 'required') : false,
        },
      },
    };
  });
};

export const extractComponentDescription = (componentName) => {
  const json = getJSONDoc();
  const componentDoc = json.included.find((doc) => doc.attributes.name === componentName);

  if (!componentDoc) {
    return '';
  }
{'fraction_non_alphanumeric': 0.13743218806509946, 'fraction_numerical': 0.0, 'mean_word_length': 3.390873015873016, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, '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': '7309636', 'n_tokens_mistral': 659, 'n_tokens_neox': 645, 'n_words': 150}