<commit_before>const Rx = require(`rx`)
const isPlainObject = require(`lodash.isplainobject`)
const isObservable = require(`./isObservable`)
const isEmpty = require(`./isEmpty`)

module.exports = function wrapObject (obj) {
  if (isObservable(obj)) {
    return obj.flatMapLatest(wrapObject)
  } else if (isPlainObject(obj) && !isEmpty(obj)) {
    const keys = Object.keys(obj)
    const length = keys.length
    const values = Array(length)<commit_msg>Do not attempt to unwrap or check an object if it has #toJS definted on it<commit_after>const Rx = require(`rx`)
const isPlainObject = require(`lodash.isplainobject`)
const isObservable = require(`./isObservable`)
const isFunction = require(`./isFunction`)
const isEmpty = require(`./isEmpty`)

module.exports = function wrapObject (obj) {
  if (isObservable(obj)) {
    return obj.flatMapLatest(wrapObject)
  } else if (obj && isFunction(obj.toJS)) {
    // fall through if `toJS` is defined
  } else if (isPlainObject(obj) && !isEmpty(obj)) {
    const keys = Object.keys(obj)
    const length = keys.length
    const values = Array(length)
{'fraction_non_alphanumeric': 0.13059360730593608, 'fraction_numerical': 0.0, 'mean_word_length': 4.62051282051282, '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': '7274727', 'n_tokens_mistral': 342, 'n_tokens_neox': 336, 'n_words': 93}