{"id":22021440,"url":"https://github.com/lamansky/entries-iterator","last_synced_at":"2026-05-04T04:34:55.323Z","repository":{"id":57225750,"uuid":"122102456","full_name":"lamansky/entries-iterator","owner":"lamansky","description":"[Node.js] Returns an iterator of the key-value pairs of an Object, Map, Array, or Typed Array.","archived":false,"fork":false,"pushed_at":"2019-09-20T05:17:04.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-23T06:37:12.958Z","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/lamansky.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-02-19T18:20:30.000Z","updated_at":"2020-07-30T12:49:51.000Z","dependencies_parsed_at":"2022-08-24T10:40:26.092Z","dependency_job_id":null,"html_url":"https://github.com/lamansky/entries-iterator","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/lamansky/entries-iterator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lamansky%2Fentries-iterator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lamansky%2Fentries-iterator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lamansky%2Fentries-iterator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lamansky%2Fentries-iterator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lamansky","download_url":"https://codeload.github.com/lamansky/entries-iterator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lamansky%2Fentries-iterator/sbom","scorecard":{"id":577729,"data":{"date":"2025-08-11","repo":{"name":"github.com/lamansky/entries-iterator","commit":"d03ec48005b136a49df2d26dc016ee784d6748be"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"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":"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":"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":"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":"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":"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":"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":"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":"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":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: license.txt:0","Info: FSF or OSI recognized license: MIT License: license.txt: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 '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-20T18:17:38.138Z","repository_id":57225750,"created_at":"2025-08-20T18:17:38.138Z","updated_at":"2025-08-20T18:17:38.138Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32595198,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-03T22:12:39.696Z","status":"online","status_checked_at":"2026-05-04T02:00:06.625Z","response_time":58,"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":[],"created_at":"2024-11-30T06:12:05.071Z","updated_at":"2026-05-04T04:34:55.275Z","avatar_url":"https://github.com/lamansky.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# entries-iterator\n\nReturns an iterator of the key-value pairs of an Object, Map, Array, or Typed Array. Useful for when you need the entries of a collection object but aren’t sure what type of collection you’ll be given.\n\n## Installation\n\nRequires [Node.js](https://nodejs.org/) 7.0.0 or above.\n\n```bash\nnpm i entries-iterator\n```\n\n## API\n\nThe module exports a single function.\n\n### Parameters\n\n1. Bindable: `c` (Array, iterator, Object, Map, Set, string, or Typed Array)\n2. Optional: Object argument:\n    * `arrays` / `maps` / `sets` (arrays of classes/strings): Arrays of classes and/or string names of classes that should be treated as equivalent to `Array`/`Map`/`Set` (respectively).\n    * `detectPairs` (boolean): This option only has an effect when `c` is an Array of two-item pairs, such as `[[1, 2], [3, 4]]`. When `detectPairs` is set to `false` (the default behavior), the Array indexes will be used as the keys (the items will be iterated as `[0, [1, 2]]` and `[1, [3, 4]]`). But if `detectPairs` is `true`, the module will interpret the first item in each pair as the entry key (the items will be iterated as `[1, 2]` and `[3, 4]`).\n    * `inObj` (boolean): Whether or not to act like the “in” operator by including inherited Object properties. Only takes effect if `c` is an Object (i.e. not another recognized type). Defaults to `false`.\n    * `reflectObj` (boolean): Whether or not to include non-enumerable Object properties by using reflection. Only takes effect if `c` is an Object (i.e. not another recognized type). Defaults to `false`.\n    * `reverse` (boolean): If `true`, then entries are iterated in reverse order. Defaults to `false`.\n\n### Return Value\n\nAn iterator which yields two-element key-value pair arrays.\n\n## Examples\n\n### Arrays\n\n```javascript\nconst entries = require('entries-iterator')\n\nconst i = entries(['a', 'b'])\ni.next().value // [0, 'a']\ni.next().value // [1, 'b']\ni.next().done // true\n\n// Supports the bind operator\n['a', 'b']::entries()\n```\n\nExamples using an array of entries (key/value pairs):\n\n```javascript\nconst entries = require('entries-iterator')\n\nconst arr = [['key1', 'val1'], ['key2', 'val2']]\n\n// Default behavior without the `detectPairs` option\nconst i1 = entries(arr)\ni1.next().value // [0, ['key1', 'val1']]\ni1.next().value // [1, ['key2', 'val2']]\ni1.next().done // true\n\n// With `detectPairs` set to `true`\nconst i2 = entries(arr, {detectPairs: true})\ni2.next().value // ['key1', 'val1']\ni2.next().value // ['key2', 'val2']\ni2.next().done // true\n```\n\n### Iterators\n\n`entries-iterator` will treat an iterator as if it were an array of values. Each “key” will be an incrementing integer index that starts at zero.\n\n```javascript\nconst entries = require('entries-iterator')\n\nfunction * gen () {\n  yield 'a'\n  yield 'b'\n}\n\nconst i = entries(gen())\ni.next().value // [0, 'a']\ni.next().value // [1, 'b']\ni.next().done // true\n```\n\n### Maps\n\n```javascript\nconst entries = require('entries-iterator')\n\nconst map = new Map()\nmap.set('key', 'value')\n\nconst i = entries(map)\ni.next().value // ['key', 'value']\ni.next().done // true\n```\n\n### Objects\n\nWhen we say “Object” here, we mean an `Object` that does not fall under another recognized category (like Array or Map).\n\n```javascript\nconst entries = require('entries-iterator')\n\nconst i = entries({key: 'value'})\ni.next().value // ['key', 'value']\ni.next().done // true\n\n// Supports the bind operator\nconst obj = {key: 'value'}\nobj::entries()\n```\n\n#### Inherited Object Properties\n\nInclude Object properties from the prototype chain by setting `inObj` to `true`:\n\n```javascript\nconst entries = require('entries-iterator')\n\nfunction Cls () {}\nCls.prototype.key = 'value'\n\nconst i = entries(new Cls(), {inObj: true})\ni.next().value // ['key', 'value']\ni.next().done // true\n```\n\n#### Non-Enumerable Object Properties\n\nInclude non-enumerable Object properties by setting `reflectObj` to `true`:\n\n```javascript\nconst entries = require('entries-iterator')\n\nconst obj = {}\nObject.defineProperty(obj, 'key', {value: 'value', enumerable: false})\n\nconst i = entries(obj, {reflectObj: true})\ni.next().value // ['key', 'value']\ni.next().done // true\n```\n\n### Sets\n\n`entries-iterator` will treat a Set like an array, and will add integer index keys starting at zero. Note that this behavior is different from that of the built-in [`Set.prototype.entries()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/entries) method.\n\n```javascript\nconst entries = require('entries-iterator')\n\nconst set = new Set()\nset.add('first')\nset.add('second')\n\nconst i = entries(set)\ni.next().value // [0, 'first']\ni.next().value // [1, 'second']\ni.next().done // true\n```\n\n### Strings\n\n`entries-iterator` will treat a string like a character array.\n\n```javascript\nconst entries = require('entries-iterator')\n\nconst i = entries('hi')\ni.next().value // [0, 'h']\ni.next().value // [1, 'i']\ni.next().done // true\n```\n\n### Typed Arrays\n\n```javascript\nconst entries = require('entries-iterator')\n\nconst typedArray = new Int32Array(new ArrayBuffer(4))\n\nconst i = entries(typedArray)\ni.next().value // [0, 0]\ni.next().done // true\n```\n\n## Related\n\n* [entries-array](https://github.com/lamansky/entries-array)\n* [keys-iterator](https://github.com/lamansky/keys-iterator)\n* [keys-array](https://github.com/lamansky/keys-array)\n* [props-iterator](https://github.com/lamansky/props-iterator)\n* [values-iterator](https://github.com/lamansky/values-iterator)\n* [values-array](https://github.com/lamansky/values-array)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flamansky%2Fentries-iterator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flamansky%2Fentries-iterator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flamansky%2Fentries-iterator/lists"}