Skip to content

Instantly share code, notes, and snippets.

@kana
Created February 20, 2016 06:35
Show Gist options
  • Save kana/c9368875c6bd48ea3745 to your computer and use it in GitHub Desktop.
Save kana/c9368875c6bd48ea3745 to your computer and use it in GitHub Desktop.
var mapped = gearSets.map(function (gearSet, i) {
var countMap = JSON.parse(JSON.stringify(required.countMap));
return {
index: i,
value: [
gearSet.shoes === anyGear ? 1 : 2,
gearSet.clothing === anyGear ? 1 : 2,
gearSet.headgear === anyGear ? 1 : 2,
countMap[gearSet.headgear.main]-- > 0 ? 1 : 2,
countMap[gearSet.headgear.sub]-- > 0 ? 1 : 2,
orderFromGearPower[gearSet.headgear.main],
orderFromGearPower[gearSet.headgear.sub],
gearSet.headgear.name,
countMap[gearSet.clothing.main]-- > 0 ? 1 : 2,
countMap[gearSet.clothing.sub]-- > 0 ? 1 : 2,
orderFromGearPower[gearSet.clothing.main],
orderFromGearPower[gearSet.clothing.sub],
gearSet.clothing.name,
countMap[gearSet.shoes.main]-- > 0 ? 1 : 2,
countMap[gearSet.shoes.sub]-- > 0 ? 1 : 2,
orderFromGearPower[gearSet.shoes.main],
orderFromGearPower[gearSet.shoes.sub],
gearSet.shoes.name
].join(':')
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment