I have a function that has one required parameter and a variable number of parameters. I'm passing an array of blobs to the functions. A simplified version of the function looks like this:
function test(directory, blob0, blob1) {
for (var argumentIndex = 1; argumentIndex < arguments.length; argumentIndex++) {
var bytes = arguments[argumentIndex].getBytes();
//do some things
}
}
I'm using the rhino runtime so I can't use the spread operator. The closest I've come to making it work is by using the apply function, but I'm not sure how to also pass the required parameter (directory) in the test function above.
var blobs = [];
blobs[0] = getBlob();
blobs[1] = getBlob();
blobs[2] = getBlob();
test.apply(null,blobs) //doesn't set required parameter (directory)