<commit_before>import Backbone from 'backbone';
import { isEmpty, isArray, isString, isFunction, each, includes, extend, flatten, debounce } from 'underscore';
import Component, { keySymbol, keySymbols } from './Component';

export const getComponentIds = (cmp, res = []) => {
  if (!cmp) return [];
  const cmps = isArray(cmp) || isFunction(cmp.map) ? cmp : [cmp];
  cmps.map(cmp => {
    res.push(cmp.getId());
    getComponentIds(cmp.components().models, res);
  });
  return res;
};

const getComponentsFromDefs = (items, all = {}, opts = {}) => {
  const itms = isArray(items) ? items : [items];

  return itms.map(item => {
    const { attributes = {}, components } = item;
    const { id } = attributes;
    let result = item;

    if (id && all[id]) {
      result = all[id];
    }<commit_msg>Update tagName on component text update<commit_after>import Backbone from 'backbone';
import { isEmpty, isArray, isString, isFunction, each, includes, extend, flatten, debounce } from 'underscore';
import Component, { keySymbol, keySymbols } from './Component';

export const getComponentIds = (cmp, res = []) => {
  if (!cmp) return [];
  const cmps = isArray(cmp) || isFunction(cmp.map) ? cmp : [cmp];
  cmps.map(cmp => {
    res.push(cmp.getId());
    getComponentIds(cmp.components().models, res);
  });
  return res;
};

const getComponentsFromDefs = (items, all = {}, opts = {}) => {
  const itms = isArray(items) ? items : [items];

  return itms.map(item => {
    const { attributes = {}, components, tagName } = item;
    const { id } = attributes;
    let result = item;

    if (id && all[id]) {
      result = all[id];
      tagName && result.set({ tagName }, { silent: true });
    }
{'fraction_non_alphanumeric': 0.16794342958161462, 'fraction_numerical': 0.0, 'mean_word_length': 3.6267029972752045, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '235659', 'n_tokens_mistral': 547, 'n_tokens_neox': 543, 'n_words': 149}