{"id":19167076,"url":"https://github.com/psmb/psmb.mapreduce","last_synced_at":"2025-02-22T23:22:55.148Z","repository":{"id":57045508,"uuid":"71998844","full_name":"psmb/Psmb.MapReduce","owner":"psmb","description":"This package provides `.map()` and `.reduce()` FlowQuery operations.","archived":false,"fork":false,"pushed_at":"2017-02-01T12:55:31.000Z","size":36,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-03T22:48:16.625Z","etag":null,"topics":["neoscms"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/psmb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-10-26T12:02:06.000Z","updated_at":"2017-07-17T14:12:42.000Z","dependencies_parsed_at":"2022-08-24T04:11:25.338Z","dependency_job_id":null,"html_url":"https://github.com/psmb/Psmb.MapReduce","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psmb%2FPsmb.MapReduce","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psmb%2FPsmb.MapReduce/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psmb%2FPsmb.MapReduce/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psmb%2FPsmb.MapReduce/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/psmb","download_url":"https://codeload.github.com/psmb/Psmb.MapReduce/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240247171,"owners_count":19771244,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["neoscms"],"created_at":"2024-11-09T09:35:42.758Z","updated_at":"2025-02-22T23:22:55.125Z","avatar_url":"https://github.com/psmb.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Psmb.MapReduce\n\nThis package provides `.map()` and `.reduce()` FlowQuery operations.\nCould be useful, huh?\n\n## Installation\n\n`composer require 'psmb/mapreduce:@dev'`\n\n## Usage\n\n### Map\n\nTakes all items in current FlowQuery context, and transforms each value with given Eel operation.\nThere is a context variable `value` available, with a value of a current node.\n\nE.g. this would give you an array of identifiers of all child nodes of a given node:\n```\n${q(node).children().map('value.identifier')}\n```\n\nSee: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map\n\n### Reduce\n\nTakes an Eel Expression as a first argument and initial values as the second. Injects `previousValue`,\n`currentValue`, `index` and `array` context variables.\n\nE.g. imagine you have a collection of Order nodes, where each node has a price property.\nNow let's try to get a total price for all of the give nodes:\n\n```\n${q(node).children('orders').reduce('previousValue + currentValue.properties.price', 0)\n```\n\nSee: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpsmb%2Fpsmb.mapreduce","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpsmb%2Fpsmb.mapreduce","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpsmb%2Fpsmb.mapreduce/lists"}