<commit_before>const yaml = require('js-yaml')
const { Journal, Trade } = require('../domain')

const createChartFromYaml = require('./create-chart-from-yaml')

/**
 * Takes journal.yml and chart.yml and creates a journal model.
 * @param {string} journalYaml The journal.yml
 * @return {string} The ledger.yml string
 * @throws {Error} when the input yaml is broken
 */
module.exports = (journalYaml, chartYaml = {}) => {
  const chart = createChartFromYaml(chartYaml)
  const tradeFactory = new Trade.Factory(chart)
  const journal = new Journal()

  yaml.safeLoadAll(journalYaml, (data) => {
    journal.addTrade(tradeFactory.createFromObject(data))<commit_msg>:art: refactor(util): remove unused default param<commit_after>const yaml = require('js-yaml')
const { Journal, Trade } = require('../domain')

const createChartFromYaml = require('./create-chart-from-yaml')

/**
 * Takes journal.yml and chart.yml and creates a journal model.
 * @param {string} journalYaml The journal.yml
 * @return {string} The ledger.yml string
 * @throws {Error} when the input yaml is broken
 */
module.exports = (journalYaml, chartYaml) => {
  const chart = createChartFromYaml(chartYaml)
  const tradeFactory = new Trade.Factory(chart)
  const journal = new Journal()

  yaml.safeLoadAll(journalYaml, data => {
    journal.addTrade(tradeFactory.createFromObject(data))
{'fraction_non_alphanumeric': 0.1296978629329403, 'fraction_numerical': 0.0, 'mean_word_length': 4.803418803418803, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '6596456', 'n_tokens_mistral': 422, 'n_tokens_neox': 404, 'n_words': 112}