<commit_before>/* global jQuery */
'use strict';

angular.module('metadatamanagementApp').service('ParserUtil',
function() {
  var getParsedArray = function(data) {
    var parsedArray;
    if (data) {
      parsedArray = data.replace(/ /g,'').split(',');
    }
    return parsedArray;
  };

  var isNullOrEmpty = function(object) {
    return (object === null || object === undefined ||
      (jQuery.isPlainObject(object) && jQuery.isEmptyObject(object)));
  };

  var removeEmptyJsonObjects = function(json) {
    if (typeof json === 'object') {
      for (var key in json) {
        if (isNullOrEmpty(json[key])) {
          delete json[key];
        } else {
          removeEmptyJsonObjects(json[key]);
          if (isNullOrEmpty(json[key])) {
            delete json[key];
          }
        }
      }
    }
    return json;
  };
  return {
      getParsedArray: getParsedArray,
      removeEmptyJsonObjects: removeEmptyJsonObjects
    };
});
<commit_msg>#303 refinded removal of empty objects<commit_after>/* global jQuery */
'use strict';

angular.module('metadatamanagementApp').service('ParserUtil',
function() {
  var getParsedArray = function(data) {
    var parsedArray;
    if (data) {
      parsedArray = data.replace(/ /g,'').split(',');
    }
    return parsedArray;
  };

  var isNullOrEmpty = function(object) {
    return (object === null || object === undefined ||
      (jQuery.isPlainObject(object) && jQuery.isEmptyObject(object)));
  };

  var removeEmptyJsonObjects = function(json) {
    if (jQuery.isPlainObject(json)) {
      for (var key in json) {
        if (isNullOrEmpty(json[key])) {
          delete json[key];
        } else {
          removeEmptyJsonObjects(json[key]);
          if (isNullOrEmpty(json[key])) {
            delete json[key];
          }
        }
      }
    }
    return json;
  };
  return {
      getParsedArray: getParsedArray,
      removeEmptyJsonObjects: removeEmptyJsonObjects
    };
});

{'fraction_non_alphanumeric': 0.14066496163682865, 'fraction_numerical': 0.001534526854219949, 'mean_word_length': 2.6492537313432836, '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': '3110829', 'n_tokens_mistral': 592, 'n_tokens_neox': 587, 'n_words': 119}