export default {
  deleteEmptyProperty(object) {
    for (let i in object) {
      let value = object[i];
      if (typeof value === 'object') {
        if (Array.isArray(value)) {
          if (value.length == 0) {
            delete object[i];
            continue;
          }
        }
        this.deleteEmptyProperty(value);
        if (this.isEmpty(value)) {
          delete object[i];
        }
      } else {
        if (value === '' || value === null || value === undefined) {
          delete object[i];
        }
      }
    }
  },
  isEmpty(object) {
    for (let name in object) {
      return false;
    }
    return true;
  }
}
