<commit_before>require 'date'
require 'bigdecimal'
require 'bigdecimal/util'
require 'time'

module Dry
  module Types
    module Coercions
      module JSON
        def self.to_nil(input)
          input unless input.is_a?(String) && input == ''
        end

        def self.to_date(input)
          Date.parse(input)
        rescue ArgumentError
          input
        end

        def self.to_date_time(input)
          DateTime.parse(input)
        rescue ArgumentError
          input<commit_msg>Refactor `JSON.to_nil` to use `eql?`<commit_after>require 'date'
require 'bigdecimal'
require 'bigdecimal/util'
require 'time'

module Dry
  module Types
    module Coercions
      module JSON
        def self.to_nil(input)
          input unless ''.eql?(input)
        end

        def self.to_date(input)
          Date.parse(input)
        rescue ArgumentError
          input
        end

        def self.to_date_time(input)
          DateTime.parse(input)
        rescue ArgumentError
          input
{'fraction_non_alphanumeric': 0.0753221010901883, 'fraction_numerical': 0.0, 'mean_word_length': 2.0239520958083834, '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': '4715793', 'n_tokens_mistral': 295, 'n_tokens_neox': 296, 'n_words': 74}