<commit_before>// Delay the encoding of ta literal to JSON
// to a type-specific method
// --------------------------------------------------------------------------------
// @param $value: value to be stringified
// --------------------------------------------------------------------------------
// @throw "Unknown type for $value ({x})."
// --------------------------------------------------------------------------------
// @return [string|false] JSON encoded string

@function json-encode($value) {
  $types: list, map, number, string, bool, color;
  $value-type: type-of($value);
  @if $value-type != null or index($types, $value-type) {
    @return call('_json-encode--#{$value-type}', $value);
  }
  @warn "Unknown type for #{$value} (#{type-of($value)}).";
  @return false;
}<commit_msg>Slightly improved the way we delay encoding to type-specific functions<commit_after>// Delay the encoding of ta literal to JSON
// to a type-specific method
// --------------------------------------------------------------------------------
// @param $value: value to be stringified
// --------------------------------------------------------------------------------
// @throw "Unknown type for $value ({x})."
// --------------------------------------------------------------------------------
// @return [string|false] JSON encoded string

@function json-encode($value) {
  $type: type-of($value);
  @if function_exists('_json-encode--#{$type}') {
    @return call('_json-encode--#{$type}', $value);
  } 
  @warn "Unknown type for #{$value} (#{type-of($value)}).";
  @return false;
}
{'fraction_non_alphanumeric': 0.43544303797468353, 'fraction_numerical': 0.0, 'mean_word_length': 1.2173913043478262, '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': '5254644', 'n_tokens_mistral': 368, 'n_tokens_neox': 361, 'n_words': 114}