Return an array of numbers, each number tells how many items per collection

I am building an nft trading platform and this problem occured to me when Implmenting some function to send all collections with one go.

for example I have 2 bored apes and 5 crypto punks lets call each of those 2 collections for non nft people :). THose collections have id, for example bored ape #1 or crypto punk #5

I need to design an array for letting the function know which id’s belong to which collection for example.

swapMultiple(["0xA020448F7448Bcce52F31065FCd5f5D6377d6f9c","0x6e169fAc89D5F943dE1DA3bB45Fa748B9466a01b"],
  [2,3],[1000, 1001, 2000, 2002, 2003]);

The first array is the array that holds all the collections

the third array is the array that holds all the id’s

the second array is that tells you how many items per collection, so for example the first 2 ids are collection #1, so you put 2

The array with objects inside looks like this

"tokens": [
    {
        "id": "11",
        "data": {
            "name": "Azuki #11",
            "image_url": "https://lh3.googleusercontent.com/wwdP0U9rcIbPU9K-jbFBFjAlS33qAVi4-axhJo9_ucjY0Rgugy-eGbIFZGm-UrVhdkKOdhWImjyOz57x_FYcEXqwE9SaFU9YG7q2Tw",
            "description": null,
            "image_preview_url": "https://lh3.googleusercontent.com/wwdP0U9rcIbPU9K-jbFBFjAlS33qAVi4-axhJo9_ucjY0Rgugy-eGbIFZGm-UrVhdkKOdhWImjyOz57x_FYcEXqwE9SaFU9YG7q2Tw=s250"
        },
        "contract": "0xed5af388653567af2f388e6224dc7c4b3241c544"
    },
    {
        "id": "11",
        "data": {
            "name": null,
            "image_url": "https://lh3.googleusercontent.com/phV8vtTRtt_Sj_54f9mu6x6aYVVKsU8G5O3Y2Ah05Kw-U8je7qcpdsomIAbp7XD7_dAI68pfzRst8myVPzt1r8ikCtnf8zAEFKkDSCc",
            "description": null,
            "image_preview_url": "https://lh3.googleusercontent.com/phV8vtTRtt_Sj_54f9mu6x6aYVVKsU8G5O3Y2Ah05Kw-U8je7qcpdsomIAbp7XD7_dAI68pfzRst8myVPzt1r8ikCtnf8zAEFKkDSCc=s250"
        },
        "contract": "0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d"
    },
    {
        "id": "5",
        "data": {
            "name": "Azuki #5",
            "image_url": "https://lh3.googleusercontent.com/rff2xxIvalISQZb-6akwe-H7LWBFVPuzq8KkBPecKIGXDZIbwPGANFmUgEIqiVy-afpAuwZhAWaEIi2gxZu_yJ_6BGNjjHbtmntCItQ",
            "description": null,
            "image_preview_url": "https://lh3.googleusercontent.com/rff2xxIvalISQZb-6akwe-H7LWBFVPuzq8KkBPecKIGXDZIbwPGANFmUgEIqiVy-afpAuwZhAWaEIi2gxZu_yJ_6BGNjjHbtmntCItQ=s250"
        },
        "contract": "0xed5af388653567af2f388e6224dc7c4b3241c544"
    }
],

I need to find a way to implement that function with that array of objects inside.

Right now I only implement logic to get the ids and the collections the code looks like this

  const nftAddresses = trade.victim_tokens.map((token) => {
    return token.contract;
  });
  const tokenIds = trade.victim_tokens.map((token) => {
    return token.id;
  });