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

16 lines
486 B
TypeScript

import { transformSceneNode } from '@plugin/transformers';
import { PenpotNode } from '@ui/lib/types/penpotNode';
import { Children } from '@ui/lib/types/utils/children';
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)
};
};