<commit_before>/* @flow */

var uid = require('../utils/uid')
var BlockList = require('./block_list')

class Block {
  id: number;
  parentBlockListId: number;
  content: string;

  constructor(params: {parentBlockListId: number}) {
    this.id = uid()
    this.parentBlockListId = params.parentBlockListId
    this.content = "I'm block " + this.id
  }

  toJson(): {id: number; content: any; childBlockList: ?BlockList} {
    var json = {
      id: this.id,
      content: this.content
    }

    var childBlockList = this.childBlockList()

    if (childBlockList) {
      json.childBlockList = childBlockList.toJson()
    }

    return json
  }

  parentBlockList() {
    return BlockListStore.find(this.parentBlockListId)
  }

  childBlockList() {
    BlockListActions.create({ blockId: this.id })
<commit_msg>Add todo message to blocklist creation test code<commit_after>/* @flow */

var uid = require('../utils/uid')
var BlockList = require('./block_list')

class Block {
  id: number;
  parentBlockListId: number;
  content: string;

  constructor(params: {parentBlockListId: number}) {
    this.id = uid()
    this.parentBlockListId = params.parentBlockListId
    this.content = "I'm block " + this.id
  }

  toJson(): {id: number; content: any; childBlockList: ?BlockList} {
    var json = {
      id: this.id,
      content: this.content
    }

    var childBlockList = this.childBlockList()

    if (childBlockList) {
      json.childBlockList = childBlockList.toJson()
    }

    return json
  }

  parentBlockList() {
    return BlockListStore.find(this.parentBlockListId)
  }

  childBlockList() {
    // To simulate Blocks with nested block lists, add a block list to every block.
    // TODO: remove once block types are implemented
    BlockListActions.create({ blockId: this.id })

{'fraction_non_alphanumeric': 0.1206896551724138, 'fraction_numerical': 0.0, 'mean_word_length': 3.183720930232558, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1336079', 'n_tokens_mistral': 577, 'n_tokens_neox': 559, 'n_words': 140}