<commit_before>/*jshint node:true */

'use strict';

function floating(initial) {
  var val = Number(initial || 0);

  return Object.freeze({
    plus: function plus(x) {
      return floating(val + x);
    },

    minus: function minus(x) {
      return floating(val - x);
    },

    times: function times(x) {
      return floating(val * x);
    },

    div: function div(x) {
      return floating(val / x);
    },

    mod: function mod(x) {
      return floating(val % x);
    },

    pow: function pow(exponent) {
      return floating(Math.pow(val, Number(exponent)));
    },

    sqrt: function sqrt() {
      return floating(Math.sqrt(val));
    },

    equals: function plus(x) {
      return val === Number(x);
    },

    gt: function gt(x) {
      return val > Number(x);
    },

    lt: function lt(x) {
      return val < Number(x);
    },

    gte: function gte(x) {
      return val >= Number(x);
    },

    lte: function lte(x) {
      return val <= Number(x);
    },

    cmp: function cmp(x) {
      if (this.gt(x)) {
        return 1;
      }

      if (this.lt(x)) {
        return -1;
      }

      return 0;
    },

    abs: function abs() {
      return floating(Math.abs(val));
    },

    toString: function toString() {
      return val.toString();
    },

    valueOf: function valueOf() {
      return val;
    },

    toJSON: function toJSON() {
      return val;
    },
  });
}

function Floating(initial) {
  return floating(initial);
}

Floating.JSONReviver = function JSONReviver(key, value) {
  if (key === '') {
    return value;
  }

  return floating(value);
};

module.exports = function factory() {
  return Floating;
};<commit_msg>style: extract functions that are used within the implementation<commit_after>/*jshint node:true */

'use strict';

function floating(initial) {
  var val = Number(initial || 0);

  function gt(x) {
    return val > Number(x);
  }

  function lt(x) {
    return val < Number(x);
  }

  function getVal() {
    return val;
  }

  return Object.freeze({
    plus: function plus(x) {
      return floating(val + x);
    },

    minus: function minus(x) {
      return floating(val - x);
    },

    times: function times(x) {
      return floating(val * x);
    },

    div: function div(x) {
      return floating(val / x);
    },

    mod: function mod(x) {
      return floating(val % x);
    },

    pow: function pow(exponent) {
      return floating(Math.pow(val, Number(exponent)));
    },

    sqrt: function sqrt() {
      return floating(Math.sqrt(val));
    },

    equals: function plus(x) {
      return val === Number(x);
    },

    gt: gt,
    lt: lt,

    gte: function gte(x) {
      return val >= Number(x);
    },

    lte: function lte(x) {
      return val <= Number(x);
    },

    cmp: function cmp(x) {
      if (gt(x)) {
        return 1;
      }

      if (lt(x)) {
        return -1;
      }

      return 0;
    },

    abs: function abs() {
      return floating(Math.abs(val));
    },

    toString: function toString() {
      return val.toString();
    },

    valueOf: getVal,
    toJSON: getVal,
  });
}

function Floating(initial) {
  return floating(initial);
}

Floating.JSONReviver = function JSONReviver(key, value) {
  if (key === '') {
    return value;
  }

  return floating(value);
};

module.exports = function factory() {
  return Floating;
};
{'fraction_non_alphanumeric': 0.14927148379423133, 'fraction_numerical': 0.0023788284269997025, 'mean_word_length': 2.161654135338346, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '4844307', 'n_tokens_mistral': 1166, 'n_tokens_neox': 1101, 'n_words': 278}