forked from ddrilling/asb_cloud_front
6 lines
248 B
TypeScript
6 lines
248 B
TypeScript
|
export const getArrayFromLocalStorage = <T extends string = string>(name: string, sep: string | RegExp = ','): T[] | null => {
|
||
|
const raw = localStorage.getItem(name)
|
||
|
if (!raw) return null
|
||
|
return raw.split(sep).map<T>(elm => elm as T)
|
||
|
}
|