<commit_before>import { toJS }            from 'mobx';
import { isEmptyObject }   from '_common/utility';
import { CONTRACT_SHADES } from '../Constants/barriers';

export const isBarrierSupported = (contract_type) => contract_type in CONTRACT_SHADES;

export const barriersToString = (is_relative, ...barriers_list) => barriers_list.map(
    barrier => `${is_relative && !/^[+-]/.test(barrier) ? '+' : ''}${barrier}`
);

export const barriersObjectToArray = (barriers) => (
    Object.keys(barriers || {})
        .map(key => toJS(barriers[key]))
        .filter(item => !isEmptyObject(item))
);<commit_msg>Fixed issue where `barrier_2` would get undefined<commit_after>import { toJS }            from 'mobx';
import { isEmptyObject }   from '_common/utility';
import { CONTRACT_SHADES } from '../Constants/barriers';

export const isBarrierSupported = (contract_type) => contract_type in CONTRACT_SHADES;

export const barriersToString = (is_relative, ...barriers_list) => barriers_list
    .filter(barrier => barrier)
    .map(barrier => `${is_relative && !/^[+-]/.test(barrier) ? '+' : ''}${barrier}`);

export const barriersObjectToArray = (barriers) => (
    Object.keys(barriers || {})
        .map(key => toJS(barriers[key]))
        .filter(item => !isEmptyObject(item))
);
{'fraction_non_alphanumeric': 0.1678376268540203, 'fraction_numerical': 0.00078064012490242, 'mean_word_length': 4.169354838709677, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 16, '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': '3315991', 'n_tokens_mistral': 398, 'n_tokens_neox': 402, 'n_words': 84}