{"id":32258509,"url":"https://github.com/jahan-addison/minta","last_synced_at":"2025-10-22T19:49:50.253Z","repository":{"id":51385754,"uuid":"88383042","full_name":"jahan-addison/minta","owner":"jahan-addison","description":"functional pattern matcher","archived":false,"fork":false,"pushed_at":"2021-05-12T15:09:22.000Z","size":39,"stargazers_count":8,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-22T19:49:49.540Z","etag":null,"topics":["functional","javascript","matching","parser","parsing","pattern","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/minta","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jahan-addison.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-04-16T01:02:36.000Z","updated_at":"2025-10-08T18:00:55.000Z","dependencies_parsed_at":"2022-08-31T00:00:41.465Z","dependency_job_id":null,"html_url":"https://github.com/jahan-addison/minta","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/jahan-addison/minta","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jahan-addison%2Fminta","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jahan-addison%2Fminta/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jahan-addison%2Fminta/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jahan-addison%2Fminta/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jahan-addison","download_url":"https://codeload.github.com/jahan-addison/minta/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jahan-addison%2Fminta/sbom","scorecard":{"id":502165,"data":{"date":"2025-08-11","repo":{"name":"github.com/jahan-addison/minta","commit":"2df7f02aa6181e60a5780d666280ab288b181a25"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.7,"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":"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/30 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":"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":"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":"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":"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":"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: Apache License 2.0: 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"}},{"name":"Vulnerabilities","score":0,"reason":"38 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-cwfw-4gq5-mrqx","Warn: Project is vulnerable to: GHSA-g95f-p29q-9xw4","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-c6rq-rjc2-86v2","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-ff7x-qrg7-qggm","Warn: Project is vulnerable to: GHSA-8r6j-v8pm-fqw3","Warn: Project is vulnerable to: MAL-2023-462","Warn: Project is vulnerable to: GHSA-pfrx-2q88-qq97","Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj","Warn: Project is vulnerable to: GHSA-qqgx-2p2h-9c37","Warn: Project is vulnerable to: GHSA-2pr6-76vf-7546","Warn: Project is vulnerable to: GHSA-8j8c-7jfh-h6hx","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-6c8f-qphg-qjgp","Warn: Project is vulnerable to: GHSA-4xc9-xhrj-v574","Warn: Project is vulnerable to: GHSA-x5rq-j2xg-h7qm","Warn: Project is vulnerable to: GHSA-jf85-cpcp-j695","Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-h726-x36v-rx45","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-w9mr-4mfr-499f","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-3jfq-g458-7qm9","Warn: Project is vulnerable to: GHSA-r628-mhmh-qjhw","Warn: Project is vulnerable to: GHSA-9r2w-394v-53qc","Warn: Project is vulnerable to: GHSA-5955-9wpr-37jh","Warn: Project is vulnerable to: GHSA-qq89-hq3f-393p","Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36","Warn: Project is vulnerable to: GHSA-7p7h-4mm5-852v"],"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-19T22:12:47.822Z","repository_id":51385754,"created_at":"2025-08-19T22:12:47.822Z","updated_at":"2025-08-19T22:12:47.822Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280503191,"owners_count":26341693,"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-22T02:00:06.515Z","response_time":63,"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":["functional","javascript","matching","parser","parsing","pattern","typescript"],"created_at":"2025-10-22T19:49:47.105Z","updated_at":"2025-10-22T19:49:50.246Z","avatar_url":"https://github.com/jahan-addison.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Minta\n\u003e Simple, effective, functional pattern matcher.\n\n## What is pattern matching?\n\n\u003e Pattern matching is the act of checking a given sequence of tokens for the presence of the constituents of some pattern. In contrast to pattern recognition, the match usually has to be **exact**. The patterns have the form of either sequences or tree structures. Uses of pattern matching include outputting the locations (if any) of a pattern within a token sequence, to output some component of the matched pattern, and to substitute the matching pattern with some other token sequence (i.e., search and replace).\n\n## Details\n\nMinta was inspired by the pattern matching systems in Rust, Haskell, and other functional languages.\n\nTo build the project, run `npm run build`.\nTo run the test suite, run `npm test`.\n\nMinta provides a utility `match` function:\n\u003e  `match(pattern: Pattern, passthrough?: boolean): (...cases: \u003cPattern | Callback\u003e) =\u003e any`\n\n`Pattern` may be any primitive value (string, boolean, number, null, etc), an object (or constructor), an array (tuple), or a regular expression.\n\nThe applied function takes an **odd** number of ( `Pattern` case,     `callback(value)` ) pairs, with the last `callback`being the default case. The syntax fairly resembles [rust's pattern matching](https://doc.rust-lang.org/1.6.0/book/patterns.html).\n\nWhen `passthrough` is `true`, cases that match will apply on the transformed values, useful for building parsers.\n\n## How to use\n\nMinta works without Typescript and may be installed with yarn or npm:\n\n`yarn add minta`\n\nor,\n\n`npm install --save minta`.\n\nThen you can import `match`:\n\n```javascript\nimport { match } from 'minta';\nconst data = match(someValue()) (\n  'the pattern', (e) =\u003e e + ' is this value',\n  /another?/,     _  =\u003e 'that value',\n  otherwise          =\u003e false\n);\n```\n\n## Real world examples\n\n```javascript\n// clamp\nconst a = match(value) (\n  value \u003c min, _ =\u003e min,\n  value \u003c max, _ =\u003e value,\n  otherwise      =\u003e max\n);\n```\n\n```javascript\n// fibonacci\nfunction fib(n) {\n  return match(n) (\n    0, x =\u003e 1,\n    1, x =\u003e 1,\n    n \u003e= 2, x =\u003e fib(x-1) + fib(x-2),\n    otherwise =\u003e n\n  );\n}\n```\n\n```javascript\n// regex matching\nconst type = match(fileType) (\n  /\\.js/,   () =\u003e 'javascript',\n  /\\.scss/, () =\u003e 'sass',\n  /\\.json/, () =\u003e 'json',\n  /\\.yml/,  () =\u003e 'yaml',\n  otherwise    =\u003e 'json'\n);\n```\n\n```javascript\n// check for null-like values\nconst check = match(isNull()) (\n  undefined, _ =\u003e 'undefined',\n  false,     _ =\u003e 'false',\n  null,      _ =\u003e 'null',\n  otherwise    =\u003e 'default'\n); // 'null'\n```\n\n```javascript\n// passthrough (parsing)\nconst a = match([1,2,3], true) (\n  ['a','b','c'], _ =\u003e ['abc']\n  [1,2,3],       _ =\u003e [123],\n  [123],         _ =\u003e [5]\n  otherwise        =\u003e 0\n); // [5]\n```\n\n```javascript\n// class cases\nclass Example {\n  do() {\n    return 'example thing';\n  }\n}\nconst example = new Example();\nconst action = match(example) (\n  RegExp,  ()  =\u003e 'a regex',\n  String,  ()  =\u003e 'a string',\n  Example, (e) =\u003e e.do(),\n  otherwise    =\u003e false\n); // 'example thing'\n```\n\n## License\n\n\u003e Apache 2.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjahan-addison%2Fminta","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjahan-addison%2Fminta","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjahan-addison%2Fminta/lists"}