<commit_before>const clone = require('clone');

const renderer = require('./renderer');

class PostSvgTree extends Array {
  /**
   * @param {Array} array
   * @return {PostSvgTree}
   */
  static createFromArray(array) {
    let wrapper = new PostSvgTree();
    wrapper = wrapper.concat(array);
    return wrapper;
  }

  get root() {
    return this.find(node => typeof node === 'object' && 'tag' in node);
  }

  toString() {
    return renderer(this, this.options);
  }

  clone() {
    const cloned = clone(this);
    return PostSvgTree.createFromArray(cloned);
  }<commit_msg>feat: add `render` method to tree<commit_after>const clone = require('clone');

const renderer = require('./renderer');

class PostSvgTree extends Array {
  /**
   * @param {Array} array
   * @return {PostSvgTree}
   */
  static createFromArray(array) {
    let wrapper = new PostSvgTree();
    wrapper = wrapper.concat(array);
    return wrapper;
  }

  get root() {
    return this.find(node => typeof node === 'object' && 'tag' in node);
  }

  toString() {
    return renderer(this, this.options);
  }

  clone() {
    const cloned = clone(this);
    return PostSvgTree.createFromArray(cloned);
  }

  render() {
    return this.toString();
  }
{'fraction_non_alphanumeric': 0.14715447154471545, 'fraction_numerical': 0.0, 'mean_word_length': 3.289198606271777, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '4711625', 'n_tokens_mistral': 399, 'n_tokens_neox': 390, 'n_words': 98}