Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sum = Neos.Fusion:Reduce {
- items = ${ __array_of_products__ }
- initialValue = 0
- itemReducer = ${carry + item.price}
- }
- cheapest = Neos.Fusion:Reduce {
- items = ${ __array_of_products__ }
- initialValue = null
- itemReducer = ${(!carry || carry.price > item.price) ? item : carry}
- }
- filtered = Neos.Fusion:Reduce {
- items = ${ __array_of_products__ }
- initialValue = ${[]}
- itemReducer = ${(item.price > 99) ? Array.push(carry, item) : carry}
- }
- #
- # This requires new Array.set methods
- #
- grouped = Neos.Fusion:Reduce {
- items = ${ __array_of_products__ }
- initialValue = ${[]}
- itemReducer = News.Fusion:Value {
- groupName = ${item.group}
- groupCarry = ${carry[ this.groupName ] || []}
- groupValue = ${Array.push(this.groupCarry, item)}
- value = ${ Array.set(carry, this.groupName, this.groupValue) }
- }
- }
Add Comment
Please, Sign In to add comment