<commit_before>require 'react-hot-loader/patch'

React          = require 'react'
ReactDOM       = require 'react-dom'
{AppContainer} = require 'react-hot-loader'
indexOf        = require 'lodash/indexOf'
pickBy         = require 'lodash/pickBy'
concat         = require 'lodash/concat'
some           = require 'lodash/some'
kebabCase      = require 'lodash/kebabCase'
browser        = require 'detect-browser'

getBaseName = (context) -> kebabCase(context.constructor.displayName || context.constructor.name)


PASSABLE_PROPS = ['className', 'id', 'children', 'target', 'ref', 'tabIndex', 'role']
PASSABLE_PREFIXES = ['data-', 'aria-', 'on']
filterProps = (props, options = {}) ->
  pickBy props, (prop, name) ->

    indexOf(concat(PASSABLE_PROPS, options.props or []), name) > -1 or
      some(concat(PASSABLE_PREFIXES, options.prefixes or []), (prefix) ->
        name.indexOf(prefix) is 0
      )

renderRoot = (getComponent, rootEl) ->
  unless rootEl
    rootEl = document.createElement('div')
    document.body.appendChild(rootEl)

  rootEl.id = 'ox-react-root-container'
  rootEl.setAttribute('data-browser', browser.name)
  rootEl.setAttribute('data-browser-version', browser.version)

  render = ->
    Root = getComponent()
    ReactDOM.render(
      React.createElement(AppContainer, {}, React.createElement(Root))
    , rootEl)

  render()
  return render

module.exports = {getBaseName, filterProps, renderRoot}<commit_msg>add main landmark<commit_after>require 'react-hot-loader/patch'

React          = require 'react'
ReactDOM       = require 'react-dom'
{AppContainer} = require 'react-hot-loader'
indexOf        = require 'lodash/indexOf'
pickBy         = require 'lodash/pickBy'
concat         = require 'lodash/concat'
some           = require 'lodash/some'
kebabCase      = require 'lodash/kebabCase'
browser        = require 'detect-browser'

getBaseName = (context) -> kebabCase(context.constructor.displayName || context.constructor.name)


PASSABLE_PROPS = ['className', 'id', 'children', 'target', 'ref', 'tabIndex', 'role']
PASSABLE_PREFIXES = ['data-', 'aria-', 'on']
filterProps = (props, options = {}) ->
  pickBy props, (prop, name) ->

    indexOf(concat(PASSABLE_PROPS, options.props or []), name) > -1 or
      some(concat(PASSABLE_PREFIXES, options.prefixes or []), (prefix) ->
        name.indexOf(prefix) is 0
      )

renderRoot = (getComponent, rootEl) ->
  unless rootEl
    rootEl = document.createElement('div')
    document.body.appendChild(rootEl)

  rootEl.id = 'ox-react-root-container'
  rootEl.setAttribute('data-browser', browser.name)
  rootEl.setAttribute('data-browser-version', browser.version)
  rootEl.setAttribute('role', 'main')

  render = ->
    Root = getComponent()
    ReactDOM.render(
      React.createElement(AppContainer, {}, React.createElement(Root))
    , rootEl)

  render()
  return render

module.exports = {getBaseName, filterProps, renderRoot}
{'fraction_non_alphanumeric': 0.14315068493150684, 'fraction_numerical': 0.0013698630136986301, 'mean_word_length': 3.6810897435897436, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, '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': '4417139', 'n_tokens_mistral': 916, 'n_tokens_neox': 898, 'n_words': 189}