0
Fork 0
mirror of https://github.com/penpot/penpot-exporter-figma-plugin.git synced 2024-12-23 06:04:01 -05:00
penpot-exporter-figma-plugin/plugin-src/transformers/partials/transformChildren.ts

17 lines
486 B
TypeScript
Raw Normal View History

2024-04-15 07:09:48 -05:00
import { transformSceneNode } from '@plugin/transformers';
2024-04-15 07:06:38 -05:00
import { PenpotNode } from '@ui/lib/types/penpotNode';
2024-04-15 07:09:48 -05:00
import { Children } from '@ui/lib/types/utils/children';
2024-04-15 07:06:38 -05:00
export const transformChildren = async (
node: ChildrenMixin,
baseX: number = 0,
baseY: number = 0
): Promise<Children> => {
return {
children: (
await Promise.all(node.children.map(child => transformSceneNode(child, baseX, baseY)))
).filter((child): child is PenpotNode => !!child)
2024-04-15 07:06:38 -05:00
};
};