win32-def
Version:
win32 definitions for node-ffi
27 lines • 743 B
JavaScript
export function expandFFIParamArray(input) {
const res = [];
const tmp = [];
permute(input, 0, tmp, res);
return res;
}
function permute(input, index, current, result) {
if (index === input.length) {
result.push(current);
return;
}
const item = input[index];
if (Array.isArray(item)) {
const len = item.length;
for (let i = 0; i < len; i += 1) {
const tmp = item[i] ?? [];
permute(input, index + 1, current.concat(tmp), result);
}
}
else if (typeof item === 'string') {
permute(input, index + 1, current.concat([item]), result);
}
else {
throw new TypeError('invalid input');
}
}
//# sourceMappingURL=ffi.js.map