Add variants of Array.sort for address[] and bytes32[] (#4883)

Co-authored-by: Ernesto García <ernestognw@gmail.com>
This commit is contained in:
Hadrien Croubois
2024-02-12 17:34:07 +01:00
committed by GitHub
parent 72c0da9ae0
commit f8b1ddf591
12 changed files with 265 additions and 118 deletions

View File

@ -5,9 +5,7 @@ const mapValues = (obj, fn) => Object.fromEntries(Object.entries(obj).map(([k, v
const product = (...arrays) => arrays.reduce((a, b) => a.flatMap(ai => b.map(bi => [...ai, bi])), [[]]);
const unique = (...array) => array.filter((obj, i) => array.indexOf(obj) === i);
const zip = (...args) =>
Array(Math.max(...args.map(array => array.length)))
.fill()
.map((_, i) => args.map(array => array[i]));
Array.from({ length: Math.max(...args.map(array => array.length)) }, (_, i) => args.map(array => array[i]));
module.exports = {
mapValues,