<commit_before>import { ImportDeclaration, NamedImports, StringLiteral } from 'typescript';
import { Context, getContext } from '../contexts';
import { EmitResult } from './';
// import { titleCase } from 'change-case';

export const emitImportDeclaration = (node: ImportDeclaration, context: Context): EmitResult => {
  const module_specifier = (node.moduleSpecifier as StringLiteral).text.split('/').pop();
  // const module_header = titleCase(module_specifier);
  const module_context = getContext(module_specifier);
  const include_headers = module_context.include_headers.split(',').filter(x => !!x).map(header => `#include <${header}.h>\n`);
  return {
    context: {
      ...context,
      ...module_context
    },
    emitted_string: `${include_headers}#include <Gyrus.h>`
  };
}
<commit_msg>Refine imports area of transpilation<commit_after>import { ImportDeclaration, NamedImports, StringLiteral } from 'typescript';
import { Context, getContext } from '../contexts';
import { EmitResult } from './';

export const emitImportDeclaration = (node: ImportDeclaration, context: Context): EmitResult => {
  const module_specifier = (node.moduleSpecifier as StringLiteral).text.split('/').pop();
  const module_context = getContext(module_specifier);
  const emitted_string =
    (module_context.include_headers || '')
      .split(',')
      .map(header => header.trim())
      .filter(x => !!x)
      .map(header => `#include <${header}.h>`)
      .join('\n');
  return {
    context: {
      ...context,
      ...module_context
    },
    emitted_string
  };
}

{'fraction_non_alphanumeric': 0.1561504142766093, 'fraction_numerical': 0.0, 'mean_word_length': 4.080906148867314, 'pattern_counts': {'":': 0, '<': 6, '<?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': '3477862', 'n_tokens_mistral': 460, 'n_tokens_neox': 459, 'n_words': 101}