{"id":16125535,"url":"https://github.com/semibran/map","last_synced_at":"2025-10-29T05:18:15.116Z","repository":{"id":57185252,"uuid":"94508879","full_name":"semibran/map","owner":"semibran","description":":world_map: Lightweight and context-free key-value maps","archived":false,"fork":false,"pushed_at":"2017-06-30T05:54:24.000Z","size":9,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-06T13:12:39.806Z","etag":null,"topics":["associate","key","map","value"],"latest_commit_sha":null,"homepage":"","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/semibran.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-06-16T05:36:56.000Z","updated_at":"2017-06-30T05:51:22.000Z","dependencies_parsed_at":"2022-09-17T07:20:25.066Z","dependency_job_id":null,"html_url":"https://github.com/semibran/map","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/semibran/map","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semibran%2Fmap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semibran%2Fmap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semibran%2Fmap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semibran%2Fmap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/semibran","download_url":"https://codeload.github.com/semibran/map/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semibran%2Fmap/sbom","scorecard":{"id":810774,"data":{"date":"2025-08-11","repo":{"name":"github.com/semibran/map","commit":"8f75586443cf99ed9d5594463016afa9bddb731f"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"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":"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":"Code-Review","score":0,"reason":"Found 0/10 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":"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":"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":-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":"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":"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 '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-23T13:07:12.018Z","repository_id":57185252,"created_at":"2025-08-23T13:07:12.018Z","updated_at":"2025-08-23T13:07:12.018Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281563814,"owners_count":26522710,"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-10-29T02:00:06.901Z","response_time":59,"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":["associate","key","map","value"],"created_at":"2024-10-09T21:29:55.927Z","updated_at":"2025-10-29T05:18:15.100Z","avatar_url":"https://github.com/semibran.png","language":"JavaScript","readme":"# associate\n\u003e Lightweight and context-free key-value maps\n\nObjects in JavaScript have been traditionally used as [associative arrays](https://en.wikipedia.org/wiki/Associative_array) to associate keys with values. Unfortunately, these kinds of object maps can only handle keys whose types are [primitive values](https://www.ecma-international.org/ecma-262/5.1/#sec-4.3.2). Any other kinds of values will be automatically converted into a string via `.toString()`.\n```js\n\u003e map[[3, 42]] = 'dragons' // here be dragons!\n\u003e map\n{ '3,42': 'dragons' }\n\n\u003e [3, 42] in map\ntrue\n```\nThis kind of type coercion can be considered somewhat useful for arrays, which happen to be the closest that native JavaScript can get to actual tuples. However, it turns out to be practically useless when applied to other kinds of objects.\n```js\n\u003e map[{ object: 'with', stuff }] = 'big rip'\n\u003e map\n{ '[object Object]': 'big rip' }\n```\nTo address this issue, ES6 introduced the [`Map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) object, which removes the limit on what types of keys can be used.\n\nBut using the `Map` constructor doesn't just break backwards compatibility -  it also suffers from the fact that `Map` instances can't be serialized to JSON.\n```js\n\u003e JSON.stringify(new Map())\n'{}'\n```\nFeel free to move on ahead if neither of these drawbacks apply to you, but I wanted to try my hand at creating a fast and serializable model for associative arrays based strictly on primitives instead of constructors. This module is what I came up with. :tada:\n\n## usage\n[![NPM](https://nodei.co/npm/associate.png?mini)](https://www.npmjs.com/package/associate)\n\nIn this module, a map is any object with the fields `keys` and `values`, both of which are arrays.\n```js\nvar map = {\n  keys: ['foo', [3, 42]],\n  values: ['bar', 'dragons']\n}\n```\nThese two arrays are correlated (\"associated\") by index; e.g. `map.keys[0]` corresponds to `map.values[0]`.\n```js\n\u003e map.keys[0] + ' -\u003e ' + map.values[0]\n'foo -\u003e bar'\n```\nThe number of entries in a map (i.e. its size) can be determined via `map.keys.length`, which is especially useful when iterating over each entry.\n```js\nfor (var i = 0; i \u003c map.keys.length; i++) {\n  var key = map.keys[i]\n  var value = map.values[i]\n  console.log(key + ' -\u003e ' + value)\n}\n```\n\n### `get`\nUse `get(map, key)` to retrieve a `key`'s corresponding value if it exists, otherwise `undefined`.\n```js\n\u003e var get = require('associate/get')\n\u003e get(map, 'foo')\n3\n```\n\n### `set`\nTo add new entries or alter existing ones, use `set(map, key, value)`.\n```js\n\u003e var set = require('associate/set')\n\u003e set(map, 'lorem', 'ipsum')\n```\n\n### `has`\nUse `has(map, key)` to determine if `map` contains an entry called `key`.\n```js\n\u003e var has = require('associate/has')\n\u003e has(map, 'lorem')\ntrue\n```\n\n### `clear`\nTo remove an entry, use `clear(map, key)`.\n```js\n\u003e clear(map, 'foo')\ntrue\n```\nIn this scenario, `clear` returns the same value that `has(map, key)` would have returned. Therefore, it will return `false` if the given key is not found.\n```js\n\u003e clear(map, 'bogus')\nfalse\n```\nIf you would like to clear all of a map's entries without creating any new objects, simply omit the second argument.\n```js\n\u003e clear(map)\ntrue\n\n\u003e map.keys.length\n0\n```\n\n## see also\n- [`semibran/list`](https://github.com/semibran/list) - simple array operations\n\n## license\n[MIT](https://opensource.org/licenses/MIT) © [Brandon Semilla](https://git.io/semibran)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsemibran%2Fmap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsemibran%2Fmap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsemibran%2Fmap/lists"}