{"id":29561673,"url":"https://github.com/lxghtless/mode-mask","last_synced_at":"2026-05-15T12:33:42.699Z","repository":{"id":34640648,"uuid":"181359561","full_name":"lxghtless/mode-mask","owner":"lxghtless","description":"Given an array of strings or a {} of {string: number} build a mask data structure to manage things like user permissions in apps. Servers that are enabled with certain modes or features might also find this useful.","archived":false,"fork":false,"pushed_at":"2023-03-05T15:58:57.000Z","size":606,"stargazers_count":0,"open_issues_count":8,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-03T06:32:09.276Z","etag":null,"topics":["features","mode-mask","modes","nodejs","permissions","typescript"],"latest_commit_sha":null,"homepage":"https://github.com/lxghtless/mode-mask","language":"TypeScript","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/lxghtless.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":"lxghtless"}},"created_at":"2019-04-14T19:36:44.000Z","updated_at":"2022-03-31T14:06:58.000Z","dependencies_parsed_at":"2025-07-18T16:42:17.477Z","dependency_job_id":"13eaa09f-7706-42df-abe6-d10fea32164d","html_url":"https://github.com/lxghtless/mode-mask","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/lxghtless/mode-mask","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lxghtless%2Fmode-mask","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lxghtless%2Fmode-mask/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lxghtless%2Fmode-mask/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lxghtless%2Fmode-mask/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lxghtless","download_url":"https://codeload.github.com/lxghtless/mode-mask/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lxghtless%2Fmode-mask/sbom","scorecard":{"id":606781,"data":{"date":"2025-08-11","repo":{"name":"github.com/lxghtless/mode-mask","commit":"b7afb6fe22cd6e2c175b32dca80f0d2e5f994be4"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.8,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/17 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":"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":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/ci.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":"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":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/lxghtless/mode-mask/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/lxghtless/mode-mask/ci.yml/master?enable=pin","Info:   0 out of   2 GitHub-owned GitHubAction 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":"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":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":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"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 20 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":"34 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-4w2v-q235-vp99","Warn: Project is vulnerable to: GHSA-cph5-m8f7-6c5x","Warn: Project is vulnerable to: GHSA-wf5p-g6vw-rhxx","Warn: Project is vulnerable to: GHSA-jr5f-v2jv-69x6","Warn: Project is vulnerable to: GHSA-qwcr-r2fm-qrc7","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-rv95-896h-c2vc","Warn: Project is vulnerable to: GHSA-qw6h-vgh9-j6wx","Warn: Project is vulnerable to: GHSA-74fj-2j2h-c42q","Warn: Project is vulnerable to: GHSA-pw2r-vq6v-hr8c","Warn: Project is vulnerable to: GHSA-jchw-25xp-jwwc","Warn: Project is vulnerable to: GHSA-cxjh-pqwp-8mfp","Warn: Project is vulnerable to: GHSA-4q6p-r6v2-jvc5","Warn: Project is vulnerable to: GHSA-ww39-953v-wcq6","Warn: Project is vulnerable to: GHSA-jg8v-48h5-wgxg","Warn: Project is vulnerable to: GHSA-36fh-84j7-cv5h","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j","Warn: Project is vulnerable to: GHSA-rhx6-c78j-4q9w","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-m6fv-jmcg-4jfg","Warn: Project is vulnerable to: GHSA-cm22-4g7w-348p","Warn: Project is vulnerable to: GHSA-g4rg-993r-mgx7","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7","Warn: Project is vulnerable to: GHSA-6fc8-4gx4-v693","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-21T01:47:10.113Z","repository_id":34640648,"created_at":"2025-08-21T01:47:10.113Z","updated_at":"2025-08-21T01:47:10.113Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33067328,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-15T11:35:32.926Z","status":"ssl_error","status_checked_at":"2026-05-15T11:35:31.362Z","response_time":103,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["features","mode-mask","modes","nodejs","permissions","typescript"],"created_at":"2025-07-18T16:39:17.555Z","updated_at":"2026-05-15T12:33:42.683Z","avatar_url":"https://github.com/lxghtless.png","language":"TypeScript","funding_links":["https://github.com/sponsors/lxghtless"],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ch2 align=\"center\"\u003emode mask\u003c/h2\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  Given an array of strings or a {} of {string: number} build a mask data structure to manage things like user \u003cb\u003epermissions\u003c/b\u003e in apps. Servers that are enabled with certain \u003cb\u003emodes\u003c/b\u003e or \u003cb\u003efeatures\u003c/b\u003e might also find this useful.\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\t\u003ca href=\"https://www.npmjs.com/package/mode-mask\"\u003e\n\t\t\u003cimg src=\"https://img.shields.io/npm/v/mode-mask?color=blue\" /\u003e\n\t\u003c/a\u003e\n\t\u003ca href=\"https://www.typescriptlang.org/\"\u003e\n\t\t\u003cimg src=\"https://aleen42.github.io/badges/src/typescript.svg\" /\u003e\n\t\u003c/a\u003e\n\t\u003ca href=\"https://eslint.org/\"\u003e\n\t\t\u003cimg src=\"https://aleen42.github.io/badges/src/eslint.svg\" /\u003e\n\t\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ch3 align=\"center\"\u003eInstall\u003c/h3\u003e\n\u003c/p\u003e\n\n\u003cpre align=\"center\"\u003enpm i mode-mask\u003c/pre\u003e\n\n\u003cbr /\u003e\n\n\u003cpre align=\"center\"\u003eyarn add mode-mask\u003c/pre\u003e\n\n### Basic Usage with MaskFactory\n\n```ts\nimport {buildMaskFactory} from 'mode-mask'\n\nconst modes = {\n    READ: 1,\n    WRITE: 2,\n    DELETE: 4,\n    AUTO_CREATE: 8\n}\n\n// build mask with factory from array of strings\nconst mask = buildMaskFactory({\n    values: Object.keys(modes)\n})()\n\n// get the MaskDatum of a given permissions sum\nconst rda = mask.indexOf(modes.READ + modes.DELETE + modes.AUTO_CREATE)\n// with an explicit number\nconst rda = mask.indexOf(13)\n// from string values\nconst rda = mask.fromValues(['READ', 'DELETE', 'AUTO_CREATE'])\n```\n\n### Basic Usage with MaskProvider\n\n```ts\nimport {MaskProvider} from 'mode-mask'\n\nconst modes = {\n    READ: 1,\n    WRITE: 2,\n    DELETE: 4,\n    AUTO_CREATE: 8\n}\n\n// build mask with provider with a map of \u003cstring, number\u003e\nconst mask = MaskProvider.resolveMask(modes)\n\n// get the MaskDatum of a given permissions sum\nconst rda = mask.indexOf(modes.READ + modes.DELETE + modes.AUTO_CREATE)\n// with an explicit number\nconst rda = mask.indexOf(13)\n// from string values\nconst rda = mask.fromValues(['READ', 'DELETE', 'AUTO_CREATE'])\n```\n\n### MaskProvider from values with derived mask\n\n```ts\nimport {MaskProvider} from 'mode-mask'\n\nconst expectedModes = {\n    READ: 1,\n    WRITE: 2,\n    DELETE: 4,\n    AUTO_CREATE: 8\n}\n\nconst maskProvider = MaskProvider.fromModesOrValues(Object.keys(expectedModes))\nconst {mask, modes, values} = maskProvider\n\n// get the MaskDatum of a given permissions sum\nconst rda = mask.indexOf(modes.READ + modes.DELETE + modes.AUTO_CREATE)\n// with an explicit number\nconst rda = mask.indexOf(13)\n// from string values\nconst rda = mask.fromValues(['READ', 'DELETE', 'AUTO_CREATE'])\n\n// modes are derived from values\nexpect(modes).to.deep.equal(expectedModes)\n```\n\n### MaskProvider from values with derived mask\n\n```ts\nimport {MaskProvider} from 'mode-mask'\n\nconst expectedModes = {\n    READ: 1,\n    WRITE: 2,\n    DELETE: 4,\n    AUTO_CREATE: 8\n}\n\nconst maskProvider = MaskProvider.fromModesOrValues(expectedModes)\nconst {mask, modes, values} = maskProvider\n\n// get the MaskDatum of a given permissions sum\nconst rda = mask.indexOf(modes.READ + modes.DELETE + modes.AUTO_CREATE)\n// with an explicit number\nconst rda = mask.indexOf(13)\n// from string values\nconst rda = mask.fromValues(['READ', 'DELETE', 'AUTO_CREATE'])\n\n// values are derived from modes\nexpect(values).to.deep.equal(Object.keys(expectedModes))\n```\n\n### rda output from usage examples\n\n```json\n{\n    \"sum\": 13,\n    \"values\": [\"READ\", \"DELETE\", \"AUTO_CREATE\"],\n    \"nums\": [1, 4, 8],\n    \"map\": {\n        \"READ\": 1,\n        \"DELETE\": 4,\n        \"AUTO_CREATE\": 8\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flxghtless%2Fmode-mask","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flxghtless%2Fmode-mask","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flxghtless%2Fmode-mask/lists"}