def METHOD_NAME(result):
    """
    Transform a the result returned from file and directory listing API.
    This transformer add and remove properties from File and Directory objects in the given list
    in order to align the object's properties so as to offer a better view to the file and dir
    list.
    """
    from ._transformers import transform_share_directory_json_output, transform_share_file_json_output
    return_list = []
    for each in result:
        if getattr(each, 'is_directory', None):
            setattr(each, 'type', 'dir')
            each = transform_share_directory_json_output(each)
        else:
            setattr(each, 'type', 'file')
            each = transform_share_file_json_output(each)
        return_list.append(each)
    return return_list