How to use figma-transformer - 1 common examples

To help you get started, we’ve selected a few figma-transformer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github braposo / figma-graphql / src / utils / figma.ts View on Github external
return cache.get(key);
    }
    // eslint-disable-next-line no-console
    console.log("fetching", key);

    const fn: FigmaFunction =
        params === undefined
            ? mapTypeToFunction[requestType]
            : mapTypeToFunctionWithParams[requestType];

    try {
        const { data } = await fn(id, { ...params });

        // We just need to parse the response if it's for a file, otherwise we return the raw data
        const processedData =
            "document" in data && requestType === RequestType.File ? processFile(data, id) : data;

        // Only store data that doesn't change depending on the params
        // We store it even if noCache is true so we can update the cache
        if (params === undefined) {
            cache.set(key, processedData);
        }

        return processedData as T;
    } catch (e) {
        throw new Error(e);
    }
}

figma-transformer

```js import { processFile } from "figma-transformer";

MIT
Latest version published 3 years ago

Package Health Score

54 / 100
Full package analysis

Popular figma-transformer functions