mirror of
https://github.com/penpot/penpot-exporter-figma-plugin.git
synced 2024-12-22 21:53:27 -05:00
1ebdf3e59d
* Fix components * fix lint
17 lines
439 B
TypeScript
17 lines
439 B
TypeScript
export const toObject = <T>(map: Map<string, T>): Record<string, T> => {
|
|
return Object.fromEntries(map.entries());
|
|
};
|
|
|
|
export const toArray = <T>(map: Map<string, T>): [string, T][] => {
|
|
return Array.from(map.entries());
|
|
};
|
|
|
|
export const init = <T>(map: Map<string, T>, records: Record<string, T>) => {
|
|
map.clear();
|
|
|
|
const entries = Object.entries(records);
|
|
|
|
for (const [key, value] of entries) {
|
|
map.set(key, value);
|
|
}
|
|
};
|