Zezombye/overpy

Add __splitObjectArray__

Opened this issue · 0 comments

 __splitObjectArray__({
    hero: waveHeroes,
    length: waveLengths
}, [
    {
        hero: Hero.ANA,
        length: 3,
    }, {
        length: 8,
        hero: Hero.SOLDIER,
    }, {
        hero: Hero.HAMMOND,
    }
])

->

waveHeroes = [Hero.ANA, Hero.SOLDIER, Hero.HAMMOND]
waveLengths = [3, 8, null]

Replaces the need to use a JS macro for this commonly used programming pattern.

Throw an error if one of the objects has a key not referenced in the variables dict. If a key is missing, set it to null.