2017 © Pedro Peláez
 

neos-package mapreduce

Map/Reduce FlowQuery operations

image

psmb/mapreduce

Map/Reduce FlowQuery operations

  • Wednesday, February 1, 2017
  • by dimaip
  • Repository
  • 1 Watchers
  • 2 Stars
  • 1,080 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 27 % Grown

The README.md

Psmb.MapReduce

This package provides .map() and .reduce() FlowQuery operations. Could be useful, huh?, (*1)

Installation

composer require 'psmb/mapreduce:@dev', (*2)

Usage

Map

Takes all items in current FlowQuery context, and transforms each value with given Eel operation. There is a context variable value available, with a value of a current node., (*3)

E.g. this would give you an array of identifiers of all child nodes of a given node:, (*4)

${q(node).children().map('value.identifier')}

See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map, (*5)

Reduce

Takes an Eel Expression as a first argument and initial values as the second. Injects previousValue, currentValue, index and array context variables., (*6)

E.g. imagine you have a collection of Order nodes, where each node has a price property. Now let's try to get a total price for all of the give nodes:, (*7)

${q(node).children('orders').reduce('previousValue + currentValue.properties.price', 0)

See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce, (*8)

The Versions

01/02 2017

dev-master

9999999-dev

Map/Reduce FlowQuery operations

  Sources   Download

LGPL-3.0+

The Requires

 

01/02 2017

v2.0

2.0.0.0

Map/Reduce FlowQuery operations

  Sources   Download

LGPL-3.0+

The Requires

 

26/10 2016

v1.0

1.0.0.0

Map/Reduce FlowQuery operations

  Sources   Download

LGPL-3.0+

The Requires