@scaleway/use-analytics
Version:
A small hook to handle events analytics
20 lines (19 loc) • 330 B
JavaScript
const normalizeId = (id) => {
if (id === null || id === void 0) {
return void 0;
}
if (typeof id === "string") {
try {
const parsed = JSON.parse(id);
if (typeof parsed === "string") {
return parsed;
}
} catch {
}
return id;
}
return String(id);
};
export {
normalizeId
};