4

I'm experimenting with the CustomJS module inside of Make (was integromat). It appears to be quite counterintuitive.

If I set the input to look like this:

input = {"json": {"items": [{"item1":"fdafd","SKU":"SKU1"},{"item2":"fdafd","SKU":"SKU3"}], "products" :["SKU1", "SKU2"]}

The following works fine:

function fudge(inp) { return inp.products;}
fudge(input)

I can see the output gets the 2 item array. But the following Fails:

function fudge(inp){ let ret = []; ret = inp.products; return ret;} fudge(input)

Excuse the one liner. I was experimenting to see if line breaks affected it. What gives here? I'm a bit of a generalist, so I appreciate I may be missing some of the finer points.

Anyone know why this doesn't work? And extending this onward, the goal is actually to produce an output that grabs the SKU values from the items too. Some thing like:

for (let i=0; i < items.length; i++) {
    ret.push(items[i].SKU;
}

But obviously, I can't run this, since I can't even run the simple first bit yet.

monkey
  • 1,213
  • 2
  • 13
  • 35

0 Answers0