Skip to content

Instantly share code, notes, and snippets.

@HackingGate
Last active November 26, 2023 06:53
Show Gist options
  • Save HackingGate/f5df746398ca2c46ff43f0e754f7ba12 to your computer and use it in GitHub Desktop.
Save HackingGate/f5df746398ca2c46ff43f0e754f7ba12 to your computer and use it in GitHub Desktop.
const crossConcatReducer = (acc, cur, idx) => {
const gap = idx + 1;
cur.forEach((element, i) => {
const indexToInsert = (i + 1) * gap - 1;
acc.splice(indexToInsert, 0, element);
});
return acc;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment