export function permutation(source) {
const arr = Object.keys(source);
const result = [];
const _result = {};
const convert = (arr, index) => {
for (let i = 0; i < source[arr[index]].length; i++) {
if (source[arr[index]][i]) {
_result[arr[index]] = source[arr[index]][i];
if (index === arr.length - 1) {
result.push(JSON.parse(JSON.stringify(_result)));
} else {
convert(arr, index + 1);
}
}
}
};
convert(arr, 0);
return result;
}
source:{name:[‘zhang’,‘li’],age:[10,20,15]}