/**
 * ldesign v0.2.14
 * (c) 2022/11/2 16:16 built by swimly
 * @license MIT
 */

import cloneDeep from 'lodash/cloneDeep';

const getSingleContent = (value, options) => {
  for (const option of options) {
    if (option.value === value) {
      return (option === null || option === void 0 ? void 0 : option.label) || String(option.value);
    }
  }
  return value !== void 0 && value !== null ? String(value) : void 0;
};
const getMultipleContent = (value, options) => {
  const res = [];
  for (const iterator of value) {
    const resLabel = getSingleContent(iterator, options);
    if (resLabel) res.push(resLabel);
  }
  return res;
};
const getNewMultipleValue = (innerValue, optionValue) => {
  const value = cloneDeep(innerValue);
  const valueIndex = value.indexOf(optionValue);
  if (valueIndex < 0) value.push(optionValue);else value.splice(valueIndex, 1);
  return {
    value,
    isCheck: valueIndex < 0
  };
};

export { getMultipleContent, getNewMultipleValue, getSingleContent };
//# sourceMappingURL=utils.js.map
