{"id":17228197,"url":"https://github.com/decompil3d/random-from-collection","last_synced_at":"2026-02-14T11:35:23.209Z","repository":{"id":34088700,"uuid":"138917753","full_name":"decompil3d/random-from-collection","owner":"decompil3d","description":"Get a random set of _n_ distinct values from a standard collection (i.e. Map, Set)","archived":false,"fork":false,"pushed_at":"2025-02-18T00:43:52.000Z","size":477,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-17T07:46:08.637Z","etag":null,"topics":[],"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/decompil3d.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-06-27T18:17:42.000Z","updated_at":"2024-06-16T13:22:24.000Z","dependencies_parsed_at":"2025-04-11T05:33:41.060Z","dependency_job_id":null,"html_url":"https://github.com/decompil3d/random-from-collection","commit_stats":{"total_commits":45,"total_committers":6,"mean_commits":7.5,"dds":0.7777777777777778,"last_synced_commit":"3d6bf9abfd369c8cd7289e9ce21bccacbe0a9ca4"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/decompil3d/random-from-collection","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/decompil3d%2Frandom-from-collection","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/decompil3d%2Frandom-from-collection/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/decompil3d%2Frandom-from-collection/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/decompil3d%2Frandom-from-collection/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/decompil3d","download_url":"https://codeload.github.com/decompil3d/random-from-collection/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/decompil3d%2Frandom-from-collection/sbom","scorecard":{"id":331540,"data":{"date":"2025-08-11","repo":{"name":"github.com/decompil3d/random-from-collection","commit":"1d98deb973a48153a91e33969a5a1871a0b6c5a8"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.8,"checks":[{"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":"Code-Review","score":0,"reason":"Found 0/12 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":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","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":"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":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/node.js.yml:1","Info: no jobLevel write permissions found"],"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":"Pinned-Dependencies","score":3,"reason":"dependency not pinned by hash detected -- score normalized to 3","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/node.js.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/decompil3d/random-from-collection/node.js.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/node.js.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/decompil3d/random-from-collection/node.js.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/node.js.yml:28: update your workflow using https://app.stepsecurity.io/secureworkflow/decompil3d/random-from-collection/node.js.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/node.js.yml:38: update your workflow using https://app.stepsecurity.io/secureworkflow/decompil3d/random-from-collection/node.js.yml/main?enable=pin","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   2 third-party GitHubAction dependencies pinned","Info:   1 out of   1 npmCommand dependencies pinned"],"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":"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":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":"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 'main'"],"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 21 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":1,"reason":"9 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-76p7-773f-r4q5","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3"],"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-18T03:46:22.458Z","repository_id":34088700,"created_at":"2025-08-18T03:46:22.458Z","updated_at":"2025-08-18T03:46:22.458Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29443452,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-14T10:51:12.367Z","status":"ssl_error","status_checked_at":"2026-02-14T10:50:52.088Z","response_time":53,"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":[],"created_at":"2024-10-15T04:22:04.058Z","updated_at":"2026-02-14T11:35:23.193Z","avatar_url":"https://github.com/decompil3d.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"![CI](https://github.com/decompil3d/random-from-collection/workflows/CI/badge.svg) [![Coverage Status](https://coveralls.io/repos/github/decompil3d/random-from-collection/badge.svg?branch=master)](https://coveralls.io/github/decompil3d/random-from-collection?branch=master)\n\n[![NPM](https://nodei.co/npm/random-from-collection.png?downloads=true\u0026stars=true)](https://nodei.co/npm/random-from-collection/)\n\n# `random-from-collection`\n\nGet a random set of _n_ distinct values from a standard collection (i.e. `Map`, `Set`).\n\n## Why?\n\nTypes like `Map` and `Set` do not allow for access by index, so pulling a random set of values requires using an\niterator. This package handles that scenario.\n\n## API\n\nThis package exports a single function that accepts a collection and a number of values to select. The collection can be\nany object that provides a `size` or `length` property/getter, and a `keys()` method that returns an iterator. In\nparticular, it is useful for built-in types like `Map` and `Set`.\n\nIt can be used on Arrays, but wouldn't really be very efficient, as Array allows for direct access by index so it is\nmuch faster to use a package like [`array-shuffle`](https://www.npmjs.com/package/array-shuffle) instead.\n\n## Usage\n\n```js\nconst randomFromCollection = require('random-from-collection');\n\nconst mySet = new Set([1, 2, 3, 4, 5, 6, 7, 8, 9]);\nconst setResults = randomFromCollection(mySet, 5);\n/*\n[1, 4, 6, 8, 9]\n*/\n\nconst myMap = new Map([\n  ['a', 'A'],\n  ['b', 'B'],\n  ['c', 'C']\n]);\nconst mapResults = randomFromCollection(myMap, 2);\n/*\n['a', 'c']\n*/\n\n// Need Map values?\nconst mapResultsValues = mapResults.map(k =\u003e myMap.get(k));\n/*\n['A', 'C']\n*/\n```\n\n## Tests\n\nWe have tests. You can run them for great justice.\n\n```sh\nnpm test\n```\n\n## Contributing\n\nSure. Go ahead. Just remember to include tests. k thx.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdecompil3d%2Frandom-from-collection","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdecompil3d%2Frandom-from-collection","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdecompil3d%2Frandom-from-collection/lists"}