import { getValueByKeys } from "../../utils/index.js";
import { isArr, isNumber, isString } from "@pisell/utils";
//#region src/components/table/Table/fields/treeSelect/filterUtil/index.ts
function filterUtil_default({ value, key, item }) {
	if (!value || Array.isArray(value) && value.length === 0) return true;
	const dataValue = getValueByKeys(item, key);
	if (isArr(value)) return value.some((item) => {
		if (isString(item) || isNumber(item)) return item == dataValue;
		else if ("value" in item) return item.value == dataValue;
		return false;
	});
	return value == dataValue;
}
//#endregion
export { filterUtil_default as default };
