UNPKG

@opensig/opendesign

Version:

20 lines (19 loc) 486 B
import { uniqueId } from "../_utils/helper.mjs"; import { isFunction, isString, isNumber } from "../_utils/is.mjs"; const getUId = uniqueId; const vUid = { created(el, binding) { const value = binding.value; if (isFunction(value)) { value(el, el.id || uniqueId()); } else if (isString(value) || isNumber(value)) { el.setAttribute("id", String(value)); } else if (!el.id) { el.setAttribute("id", uniqueId()); } } }; export { getUId, vUid };