vue3-draggable-next
Version:
draggable component for vue
17 lines (14 loc) • 441 B
JavaScript
function cached(fn) {
const cache = Object.create(null);
return function cachedFn(str) {
const hit = cache[str];
return hit || (cache[str] = fn(str));
};
}
const regex = /-(\w)/g;
const camelize = cached(str => str.replace(regex, (_, c) => c.toUpperCase()));
let guid = Date.now();
export function uniqueId(prefix = "") {
return `${prefix ? `${prefix}_` : ""}${(guid++).toString(36).toLowerCase()}`;
}
export { camelize };