{"id":34248199,"url":"https://github.com/theadam/pivoter","last_synced_at":"2025-12-16T08:06:10.094Z","repository":{"id":57324971,"uuid":"80159740","full_name":"theadam/pivoter","owner":"theadam","description":"A library to create pivot tables that you can plug into any view library","archived":false,"fork":false,"pushed_at":"2017-02-14T05:47:28.000Z","size":242,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-09-25T17:47:15.274Z","etag":null,"topics":["data","pivot-tables","table"],"latest_commit_sha":null,"homepage":"https://theadam.github.io/pivoter/example","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/theadam.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-26T21:59:28.000Z","updated_at":"2024-07-08T16:22:35.000Z","dependencies_parsed_at":"2022-09-06T09:12:33.587Z","dependency_job_id":null,"html_url":"https://github.com/theadam/pivoter","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/theadam/pivoter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theadam%2Fpivoter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theadam%2Fpivoter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theadam%2Fpivoter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theadam%2Fpivoter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/theadam","download_url":"https://codeload.github.com/theadam/pivoter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theadam%2Fpivoter/sbom","scorecard":{"id":877682,"data":{"date":"2025-08-11","repo":{"name":"github.com/theadam/pivoter","commit":"136312ee686c61b7f37c01a6f59f80aec5011cf2"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.6,"checks":[{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Code-Review","score":0,"reason":"Found 0/20 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-24T06:41:46.524Z","repository_id":57324971,"created_at":"2025-08-24T06:41:46.524Z","updated_at":"2025-08-24T06:41:46.524Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27761250,"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","status":"online","status_checked_at":"2025-12-16T02:00:10.477Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["data","pivot-tables","table"],"created_at":"2025-12-16T08:06:09.410Z","updated_at":"2025-12-16T08:06:10.085Z","avatar_url":"https://github.com/theadam.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pivoter\n\nThe use-whatever-view-you-want javscript pivot table library\n\n## Installation\n\n```\nnpm install --save pivoter\n```\n\n## Usage\n\nTo Just create a pivot table of some data, you can use the simple `pivot` function.\n\n```js\nimport { pivot } from 'pivoter';\n\nconst result = pivot(config);\n```\n\nTo prevent reprocessing the data on every config change, a pivoter can be created.  A pivoter can be passed config changes in an updated method.  This is good for views that are user configurable.\n\n```js\nimport Pivoter from 'pivoter';\n\n// Create a pivoter from a base config\nconst pivoter = Pivoter(config);\n\n// Subscribe to data changes\npivoter.subscribe(function(result, config) {\n    ...\n});\n\n// Change the dataSortDir option (will cause the listener to be called)\npivoter.update({ dataSortDir: 'desc' );\n```\n\n## Process Outline\n\n- Input data is grouped and reduced within groups.  The groups of data form a hierarchy of reduced data.  (See the example for a visual).  This is configured mainly by the `reducer` and `groups` config values.  There is more information in the \"Config Options\" section.\n- Data points are created from the raw reduced data in each group. This is configured by the `dataPoints` configuration value.  If none is provided, the reduced value is used.\n- Grouped data is flattened and sorted.  The sorting is handled by a few different keys.  They are outlined below in the \"Config Options\" section.\n\n## Result\n\nThe result of pivoting the data is an object with these keys\n\n### total\n\nContains:\n\n##### reduced\n\nAll of the input reduced\n\n##### data\n\nThe data points of all of the input\n\n### flattened\n\nThe final flattened data as an array.  This can be used for the main content of a pivot table view.\n\nEach entry in the array is an object that contains:\n\n##### path\n\nThe path of this group in the hierarchy\n\n##### level\n\nThe level of the group in in the hierarchy\n\n##### data\n\nThe data points of this group of input\n\n##### points\n\nAn array of all of the original input points that went into this group\n\n## Config Options\n\n### input\n\n**Type**: `Array` (*required*)\n\nThe data to perform grouping operations on\n\n### groups\n\n**Type**: `Array` (*required*)\n\nAn ordered description of how data is grouped into a hierarchy.  Each group has a `name` and a `selector` function.\n\nThis set of groups will first group all data by `firstName`, then within those groups with the same first name, data will be grouped by `lastName`.\n\n```js\nconst groups = {\n  { name: 'First Name', selector: x =\u003e x.firstName },\n  { name: 'Last Name', selector: x =\u003e x.lastName },\n};\n```\n\n### reducer\n\n**Type**: `Function(r: Reduced, i: InputRow) =\u003e Reduced` (*required*)\n\nTakes in the previous Reduced value and a single row from the input and produces the new Reduced value.  This is how data gets combined within groups.\n\n### initialValue\n\n**Type**: `Reduced`\n\n**Default**: `{}`\n\nThe default starting value when reducing groups of data.\n\n### dataPoints\n\n**Type**: `Array`\n\nDescribes how the reduced data is turned into output data.  Each dataPoint entry has a `title` key and may have a `value` key which is a function to select the dataPoint.  `dataPoints` can be nested by using the `subDataPoints` key.\n\nIf your data points are:\n\n```js\nconst dataPoints = [\n  { title: 'Monday', value: reduced =\u003e reduced.days.monday, subDataPoints: [\n    { title: 'Sales', value: monday =\u003e monday.data.sales }\n  }\n]\n```\n\nAnd your reduced data for a group is something like this:\n\n```js\n{\n  days: {\n    ...\n    monday: {\n      ...\n      data: {\n        sales: 101,\n      },\n    },\n  },\n}\n```\n\nThe output data for this group would be\n\n```js\n{ Monday: { Sales: 101 } }\n```\n\n### groupSorts\n\n**Type**: `Array`\n\nCannot be used with `dataSortsWith` or `dataSortsBy`\n\nThis is an array describing how to to sort by the groups in th sorted data.  The elements of the array can be the strings `'asc'` or `'desc'` or a [compare function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#Parameters).\n\nFor the group sorts example above\n\n```js\nconst groups = {\n  { name: 'First Name', selector: x =\u003e x.firstName },\n  { name: 'Last Name', selector: x =\u003e x.lastName },\n};\n```\n\n`['asc', 'desc']` will sort the top level data points by `firstName` ascending and the subGroups by `lastName` descending.\n\n### dataSortBy\n\n**Type**: `String | Array\u003cString\u003e | Function(d: Data) =\u003e Value`\n\nCannot be used with `dataSortsWith` or `groupSorts`\n\nDescribes how to sort the data in each group.\n\n\n| Type | Description | Example |\n|------|-------------|---------|\n| String  | it is a `.` delimited string describing a path in the data to find the value to sort on. | `'name.first'` |\n| Array of strings | it is a path in the data to find the value to sort on. | `['name', 'first']`\n| Function | it takes the data as its argument and returns the value to sort on. | `data =\u003e data.name.first` |\n\n\n### dataSortDir\n\n**Type**: `'asc' | 'desc'`\n\n**default** `'asc'`\n\nThe direction to sort when using `dataSortBy`\n\n### dataSortWith\n\n**Type**: `Function(a: Data, b: Data) =\u003e (-1 | 0 | 1)`\n\nCannot be used with `dataSortBy` or `groupSorts`\n\nA [compare function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#Parameters) used to sort the data within the groups.\n\n## License\n\nMIT\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheadam%2Fpivoter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftheadam%2Fpivoter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheadam%2Fpivoter/lists"}