@engie-group/fluid-design-system-react
Version:
Fluid Design System React
16 lines (14 loc) • 430 B
text/typescript
const mapData = ((): { get: (instance: string) => string } => {
const storeData: Record<string, string> = {};
return {
get(instance): string {
if (typeof storeData[instance] === 'undefined') {
storeData[instance] = '_' + Math.random().toString(36).substr(2, 9);
}
return storeData[instance];
}
};
})();
export const GenID = function (instance: string) {
return mapData.get(instance);
};