/**
 * tdesign v0.39.1-alpha.1
 * (c) 2022 tdesign
 * @license MIT
 */

import _typeof from '@babel/runtime/helpers/typeof';
import isEmpty from 'lodash/isEmpty';

function getFullPathLabel(node) {
  return node.getPath().map(function (node2) {
    return node2.label;
  }).join("/");
}
var getTreeValue = function getTreeValue(value) {
  var treeValue = [];

  if (Array.isArray(value)) {
    if (value.length > 0 && _typeof(value[0]) === "object") {
      treeValue = value.map(function (val) {
        return val.value;
      });
    } else if (value.length) {
      treeValue = value;
    }
  } else if (value) {
    if (_typeof(value) === "object") {
      treeValue = [value.value];
    } else {
      treeValue = [value];
    }
  }

  return treeValue;
};
var getValue = function getValue(value, valueType, multiple) {
  if (valueType === "single") {
    return value;
  }

  if (multiple) {
    return value.map(function (item) {
      return item[item.length - 1];
    });
  }

  return value[value.length - 1];
};
function isEmptyValues(value) {
  if (typeof value === "number" && !isNaN(value)) return false;
  return isEmpty(value);
}
var helper = {
  getFullPathLabel: getFullPathLabel
};

export { helper as default, getFullPathLabel, getTreeValue, getValue, isEmptyValues };
//# sourceMappingURL=helper.js.map
