Skip to content

Commit

Permalink
Make functions browser compatible (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
aparlato authored May 26, 2022
1 parent 6668980 commit 975a7b2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ figmaApi.prototype.get = async function (api, params) {

// For each nodeId, find its corresponding node by searching the document.
// Note this is pretty inefficient, we can end up traversing the entire document quite a few times. Likely insignificant on smallish documents.
findNodesById = function ({ file, nodeIds }) {
const findNodesById = function ({ file, nodeIds }) {
function findNode(nodeId, searchNode) {
if (nodeId === searchNode.id) {
return searchNode;
Expand All @@ -40,7 +40,7 @@ findNodesById = function ({ file, nodeIds }) {
return nodeIds.map((nodeId) => findNode(nodeId, file.document));
};

findNodeIdsForNames = function ({ file, names }) {
const findNodeIdsForNames = function ({ file, names }) {
// find node IDs for names with a depth-first search
function findNameInNode(name, node) {
if (name === node.name && node.type === 'FRAME') {
Expand Down

0 comments on commit 975a7b2

Please sign in to comment.