<commit_before>import 'core-js';

const runCheck = ({ rtype, onError, options }) => {
  return (...args) => {
    if (!rtype(...args) && typeof onError === 'function') {
      onError({ args, options });
    }
  };
};

const buildCheck = ({ shouldCheck, rtype, onError, options }) => {
  return shouldCheck ?
    typeof rtype === 'function' ?
      runCheck({ rtype, onError, options }) :
      null :
    null;
};

const rfx = (options = {}) => {
  const { type, onError } = options;

  const shouldCheck = process &&
    process.env.NODE_ENV !== 'production';

  const check = buildCheck({ shouldCheck, rtype: type, onError, options });

  return Object.assign(function fx (...args) {
    const { fn } = options;
    if (typeof check === 'function') check(...args);
    return fn(...args);
  }, options.fn);
};

export default rfx;<commit_msg>Satisfy “rfx with meta data”<commit_after>import 'core-js';

const runCheck = ({ rtype, onError, options }) => {
  return (...args) => {
    if (!rtype(...args) && typeof onError === 'function') {
      onError({ args, options });
    }
  };
};

const buildCheck = ({ shouldCheck, rtype, onError, options }) => {
  return shouldCheck ?
    typeof rtype === 'function' ?
      runCheck({ rtype, onError, options }) :
      null :
    null;
};

const rfx = (options = {}) => {
  const { type, onError } = options;

  const shouldCheck = process &&
    process.env.NODE_ENV !== 'production';

  const check = buildCheck({ shouldCheck, rtype: type, onError, options });

  return Object.assign(function fx (...args) {
    const { fn } = options;
    if (typeof check === 'function') check(...args);
    return fn(...args);
  }, options.fn, options);
};

export default rfx;
{'fraction_non_alphanumeric': 0.1826137689614936, 'fraction_numerical': 0.0, 'mean_word_length': 3.0258215962441315, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '3776548', 'n_tokens_mistral': 548, 'n_tokens_neox': 542, 'n_words': 148}