{"id":43256316,"url":"https://github.com/davidecalignano/byid","last_synced_at":"2026-02-01T13:33:32.023Z","repository":{"id":25864181,"uuid":"106727105","full_name":"davidecalignano/byid","owner":"davidecalignano","description":"Makes array of objects accessible","archived":false,"fork":false,"pushed_at":"2023-01-07T04:13:56.000Z","size":640,"stargazers_count":5,"open_issues_count":5,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-21T15:44:08.199Z","etag":null,"topics":["api","array","byid","ids","normalize"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/davidecalignano.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":"2017-10-12T17:56:02.000Z","updated_at":"2022-03-10T14:54:05.000Z","dependencies_parsed_at":"2023-01-14T03:45:12.285Z","dependency_job_id":null,"html_url":"https://github.com/davidecalignano/byid","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/davidecalignano/byid","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidecalignano%2Fbyid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidecalignano%2Fbyid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidecalignano%2Fbyid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidecalignano%2Fbyid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davidecalignano","download_url":"https://codeload.github.com/davidecalignano/byid/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidecalignano%2Fbyid/sbom","scorecard":{"id":326414,"data":{"date":"2025-08-11","repo":{"name":"github.com/davidecalignano/byid","commit":"607a7f8a5950a70ab9cc571a81032c9938c74027"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.7,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/6 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":"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":"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":"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":"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":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"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":"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"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 24 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"19 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-896r-f27r-55mw","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-jgrx-mgxx-jf9v","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-18T02:35:13.005Z","repository_id":25864181,"created_at":"2025-08-18T02:35:13.005Z","updated_at":"2025-08-18T02:35:13.005Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28979132,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-01T12:13:08.691Z","status":"ssl_error","status_checked_at":"2026-02-01T12:13:08.356Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["api","array","byid","ids","normalize"],"created_at":"2026-02-01T13:33:31.709Z","updated_at":"2026-02-01T13:33:32.015Z","avatar_url":"https://github.com/davidecalignano.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# byId [![Build Status](https://travis-ci.org/davidecalignano/byid.svg?branch=master)](https://travis-ci.org/davidecalignano/byid) [![Coverage Status](https://coveralls.io/repos/github/davidecalignano/byid/badge.svg?branch=master)](https://coveralls.io/github/davidecalignano/byid?branch=master)\nMakes array of objects accessible\n\n## Motivation\n**ById** is inspired by the [normalized way](http://redux.js.org/docs/recipes/reducers/NormalizingStateShape.html) to handle the state in redux and the [*normalizr*](https://github.com/paularmstrong/normalizr) utility.\n\nUnlike *normalizr*, **byId** does not group the data in entities and you don't create relationship data on entities to preserve the information on nested objects, but rather it maintains the object structure as the input and normalizes all the arrays recursivly based on a schema which specify what should be normalized and what not.\n\n## Advantages\n- The normalization makes easy to access to array of items withouth iterating over it.\n- Improves performances.\n\n## Install\n\n```bash\nnpm install byid\n```\n\n## API\n* [normalize](#normalizedata-schema)\n* [denormalize](#denormalizedata-schema)\n\n## `normalize(data, schema)`\nReturn the normalized data based on the provided schema.\n\n* `data`: **required** Data that needs normalization.\n* `schema`: **required** An object that defines the schema of what needs normalizations and additionally specify the key (default *id*). All the data not specified in the schema will be copied in the new object as is.\n\n## Usage\n\n```js\nimport { normalize } from 'byid';\nconst data = {\n    name: 'Mark',\n    posts: [{id: 123, comments: []}, {id: 456, comments: []}]\n}\nconst schema = {\n    posts: {}\n}\n\nconst output = normalize(data, schema)\n\n```\n\n### Output\n```js\n{\n    name: 'Mark',\n    posts: {\n        ids: [123, 456],\n        byId: {\n            123: {id: 123, comments: []},\n            456: {id: 456, comments: []}\n        }\n    }\n}\n```\n\n## `denormalize(data, schema)`\nReturn the original data based on the provided schema.\n\n* `data`: **required** Data that needs to be reverted in the original shape.\n* `schema`: **required** The schema provided in the normalization.\n\n## Usage\n\n```js\nimport { denormalize } from 'byid';\nconst data = {\n    name: 'Mark',\n    posts: {\n        ids: [123, 456],\n        byId: {\n            123: {id: 123, comments: []},\n            456: {id: 456, comments: []}\n        }\n    }\n}\nconst schema = {\n    posts: {}\n}\n\nconst output = denormalize(data, schema)\n\n```\n\n### Output\n```js\n{\n    name: 'Mark',\n    posts: [{id: 123, comments: []}, {id: 456, comments: []}]\n}\n```\n\n## Examples\n[Nested normalization](examples/nested-normalization.md)\n\n\n## Dependencies\nNone.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidecalignano%2Fbyid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavidecalignano%2Fbyid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidecalignano%2Fbyid/lists"}