/**
 * tdesign v0.32.0
 * (c) 2021 tdesign
 * @license MIT
 */

'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var _typeof = require('@babel/runtime/helpers/typeof');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var _typeof__default = /*#__PURE__*/_interopDefaultLegacy(_typeof);

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__default["default"](value[0]) === "object") {
      treeValue = value.map(function (val) {
        return val.value;
      });
    } else if (value.length) {
      treeValue = value;
    }
  } else if (value) {
    if (_typeof__default["default"](value) === "object") {
      treeValue = [value.value];
    } else {
      treeValue = [value];
    }
  }

  return treeValue;
};
var helper = {
  getFullPathLabel: getFullPathLabel
};

exports["default"] = helper;
exports.getFullPathLabel = getFullPathLabel;
exports.getTreeValue = getTreeValue;
//# sourceMappingURL=helper.js.map
