function parseValueArray(objectValues, currentValue) {
	let selectedValues;
	if (Array.isArray(objectValues)) {
		selectedValues = [...objectValues];
	} else {
		const keys = Object.keys(objectValues);
		selectedValues = keys.map((key) => (objectValues[key] ? key : null));
	}

	if (selectedValues.includes(currentValue)) {
		return selectedValues.filter((item) => item !== currentValue);
	}
	return [...selectedValues, currentValue];
}
To determine wether an element is a function
@param {any} element