{"id":21018584,"url":"https://github.com/kenote/rule-judgment","last_synced_at":"2026-04-29T07:33:45.609Z","repository":{"id":97159582,"uuid":"304346844","full_name":"kenote/rule-judgment","owner":"kenote","description":"A query statement similar to mongodb, judge and retrieve data.","archived":false,"fork":false,"pushed_at":"2021-11-08T08:11:24.000Z","size":25,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-02T21:41:50.403Z","etag":null,"topics":["filter","json","query"],"latest_commit_sha":null,"homepage":"","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/kenote.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-10-15T14:10:17.000Z","updated_at":"2025-07-08T07:17:01.000Z","dependencies_parsed_at":"2023-06-10T01:02:20.095Z","dependency_job_id":null,"html_url":"https://github.com/kenote/rule-judgment","commit_stats":{"total_commits":15,"total_committers":1,"mean_commits":15.0,"dds":0.0,"last_synced_commit":"2c45a2912d5791c033258804d5e7c2ee203505f1"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/kenote/rule-judgment","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kenote%2Frule-judgment","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kenote%2Frule-judgment/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kenote%2Frule-judgment/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kenote%2Frule-judgment/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kenote","download_url":"https://codeload.github.com/kenote/rule-judgment/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kenote%2Frule-judgment/sbom","scorecard":{"id":555501,"data":{"date":"2025-08-11","repo":{"name":"github.com/kenote/rule-judgment","commit":"2c45a2912d5791c033258804d5e7c2ee203505f1"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"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":"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":"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":"Code-Review","score":0,"reason":"Found 0/15 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":"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":"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":"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 '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"}}]},"last_synced_at":"2025-08-20T12:13:55.995Z","repository_id":97159582,"created_at":"2025-08-20T12:13:55.996Z","updated_at":"2025-08-20T12:13:55.996Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32416145,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T06:29:02.080Z","status":"ssl_error","status_checked_at":"2026-04-29T06:29:00.631Z","response_time":110,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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":["filter","json","query"],"created_at":"2024-11-19T10:26:38.531Z","updated_at":"2026-04-29T07:33:45.568Z","avatar_url":"https://github.com/kenote.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rule-judgment\n\nA query statement similar to mongodb, judge and retrieve data.\n\n[![NPM Version][npm-image]][npm-url]\n[![NPM Downloads][downloads-image]][downloads-url]\n[![Build Status][travis-image]][travis-url]\n[![Gratipay][licensed-image]][licensed-url]\n\n## Installation\n\n```bash\n$ npm install rule-judgment\n#\n$ yarn add rule-judgment\n```\n\n## Features\n\n- Supported operators: [\\$lt](#lt), [\\$lte](#lte), [\\$gt](#gt), [\\$gte](#gte), [\\$eq](#eq), [\\$ne](#ne), [\\$regex](#regex), [\\$mod](#mod), [\\$in](#in), [\\$nin](#nin), [\\$_in](#-in), [\\$_nin](#-nin), [\\$size](#size), [\\$exists](#exists), [\\$type](#type), [\\$where](#where), [\\$and](#and), [\\$or](#or), [\\$not](#not), [\\$nor](#nor)\n- Regexp searches\n- Supports node.js, and web\n\n## Usages\n\n```js\nimport ruleJudgment from 'rule-judgment'\n\n// target data is non-object data\nconst filter = ruleJudgment({ $lt: 5 })\n\n// target data is object data\nconst filter = ruleJudgment({ level: { $lt: 5 } })\n\n// use context\nconst context = {\n  $__username: 'thondery',\n  $__level: 5\n}\nconst filter = ruleJudgment({ \n  $or: [\n    { username: '$__username' },\n    { level: { $gte: '$__level' }}\n  ] \n}, context)\n\n[\n  { username: 'admin', level: 9 },\n  { username: 'thondery', level: 5 },\n  { username: 'test', level: 1 },\n].filter( filter )\n// [ { username: 'admin', level: 9 }, { username: 'thondery', level: 5 } ]\n```\n\n## API\n\n### ruleJudgment (query: MongoQuery, options?: Options): (data: any) =\u003e boolean\n\nCreates a filter with all of the built-in MongoDB query operations.\n\n- `query` - the filter to use against the target data\n- `options` - `context` hash\n- `data` - target data\n\nExample:\n\n```js\nimport ruleJudgment from 'rule-judgment'\n\nconst filter = ruleJudgment({ $lt: 5 })\n\nfilter(6) // false\nfilter(4) // true\n\n[0, 1, 2, 3, 4, 5].filter( filter )\n// [0, 1, 2, 3, 4]\n```\n\n## Supported Operators\n\n### \\$lt\n\nMatches values that are less than a specified value.\n\n```js\n// types: number | bigint | Date\n\n[0, 1, 2, 3, 4, 5].filter( ruleJudgment({ $lt: 3 }) )\n// [0, 1, 2]\n```\n\n### \\$lte\n\nMatches values that are less than or equal to a specified value.\n\n```js\n// types: number | bigint | Date\n\n[0, 1, 2, 3, 4, 5].filter( ruleJudgment({ $lte: 3 }) )\n// [0, 1, 2, 3]\n```\n\n### \\$gt\n\nMatches values that are greater than a specified value.\n\n```js\n// types: number | bigint | Date\n\n[0, 1, 2, 3, 4, 5].filter( ruleJudgment({ $gt: 3 }) )\n// [4, 5]\n```\n\n### \\$gte\n\nMatches values that are greater than or equal to a specified value.\n\n```js\n// types: number | bigint | Date\n\n[0, 1, 2, 3, 4, 5].filter( ruleJudgment({ $gte: 3 }) )\n// [3, 4, 5]\n```\n\n### \\$eq\n\nMatches values that are equal to a specified value.\n\n```js\n// types: any\n\n['admin', 'thondery', 'test'].filter( ruleJudgment({ $eq: 'thondery' }) )\n// ['thondery']\n```\n\n### \\$ne\n\nMatches all values that are not equal to a specified value.\n\n```js\n// types: any\n\n['admin', 'thondery', 'test'].filter( ruleJudgment({ $ne: 'thondery' }) )\n// ['admin', 'test']\n```\n\n### \\$regex\n\nSelects documents where values match a specified regular expression.\n\n```js\n// types: string\n\n['admin', 'thondery', 'test'].filter( ruleJudgment({ $regex: /thondery/i }) )\n// ['thondery']\n```\n\n### \\$mod\n\nPerforms a modulo operation on the value of a field and selects documents with a specified result.\n\n```js\n// types: number | bigint\n\n[0, 1, 2, 3, 4, 5].filter( ruleJudgment({ $mod: [2, 0] }) )\n// [0, 2, 4]\n```\n\n### \\$in\n\nMatches any of the values specified in an array.\n\n```js\n// types: any\n\n['admin', 'thondery', 'test'].filter( ruleJudgment({ $in: ['thondery', 'admin'] }) )\n// ['admin', 'thondery']\n```\n\n### \\$nin\n\nMatches none of the values specified in an array.\n\n```js\n// types: any\n\n['admin', 'thondery', 'test'].filter( ruleJudgment({ $nin: ['thondery', 'admin'] }) )\n// ['test']\n```\n\n### \\$_in\n\nMatch any value in the array.\n\n```js\n// types: any[]\n\nruleJudgment({ $_in: 'thondery' })(['admin', 'thondery', 'test'])\n// true\nruleJudgment({ $_in: ['admin', 'thondery'] })(['admin', 'thondery', 'test'])\n// true\n```\n\n### \\$_nin\n\nMatch any value not in the array.\n\n```js\n// types: any[]\n\nruleJudgment({ $_nin: 'thondery' })(['admin', 'thondery', 'test'])\n// false\nruleJudgment({ $_nin: ['admin', 'thondery'] })(['admin', 'thondery', 'test'])\n// false\n```\n\n### \\$size\n\nSelects documents if the array field is a specified size.\n\n```js\n// types: any[]\n\n[['admin', 'thondery', 'test'], [0, 1, 2, 3, 4, 5]].filter( ruleJudgment({ $size: 6 }) )\n// [ [0, 1, 2, 3, 4, 5] ]\n[['admin', 'thondery', 'test'], [0, 1, 2, 3, 4, 5]].filter( ruleJudgment({ $size: { $lt: 5 } }) )\n// [ ['admin', 'thondery', 'test'] ]\n```\n\n### \\$exists\n\nMatches documents that have the specified field.\n\n```js\n// types: any\n\n['test', 0, 1, 2, 3, null, undefined, true, false].filter( ruleJudgment({ $exists: true }) )\n// ['test', 0, 1, 2, 3, true, false]\n['test', 0, 1, 2, 3, null, undefined, true, false].filter( ruleJudgment({ $exists: false }) )\n// [null, undefined]\n```\n\n### \\$type\n\nSelects documents if a field is of the specified type.\n\n```js\n// types: any\n\n['test', 0, 1, 2, 3, null, undefined, true, false].filter( ruleJudgment({ $type: 'number' }) )\n// [0, 1, 2, 3]\n```\n\n### \\$where\n\nMatches documents that satisfy a JavaScript expression.\n\n```js\n// types: any\n\n['test', 0, 1, 2, 3, null, undefined, true, false].filter( ruleJudgment({ $where: item =\u003e item === 'test' }) )\n// ['test']\n```\n\n### \\$and\n\nJoins query clauses with a logical AND returns all documents that match the conditions of both clauses.\n\n```js\n// types: any\n\n['test', 0, 1, 2, 3, null, undefined, true, false].filter( ruleJudgment({ $and: [{ $eq: 'test' }, { $type: 'string' }] }) )\n// ['test']\n```\n\n### \\$or\n\nJoins query clauses with a logical OR returns all documents that match the conditions of either clause.\n\n```js\n// types: any\n\n['test', 0, 1, 2, 3, null, undefined, true, false].filter( ruleJudgment({ $or: [{ $eq: 'test' }, { $type: 'boolean' }] }) )\n// ['test', true, false]\n```\n\n### \\$not\n\nInverts the effect of a query expression and returns documents that do not match the query expression.\n\n```js\n// types: any\n\n['test', 0, 1, 2, 3, null, undefined, true, false].filter( ruleJudgment({ $not: { $eq: 'test' } }) )\n// [0, 1, 2, 3, null, undefined, true, false]\n```\n\n### \\$nor\n\nJoins query clauses with a logical NOR returns all documents that fail to match both clauses.\n\n```js\n// types: any\n\n['test', 0, 1, 2, 3, null, undefined, true, false].filter( ruleJudgment({ $nor: [{ $eq: 'test' }, { $type: 'boolean' }] }) )\n// [0, 1, 2, 3, null, undefined]\n```\n\n## License\n\nthis repo is released under the [MIT License](https://github.com/kenote/rule-judgment/blob/main/LICENSE).\n\n[npm-image]: https://img.shields.io/npm/v/rule-judgment.svg\n[npm-url]: https://www.npmjs.com/package/rule-judgment\n[downloads-image]: https://img.shields.io/npm/dm/rule-judgment.svg\n[downloads-url]: https://www.npmjs.com/package/rule-judgment\n[travis-image]: https://travis-ci.com/kenote/rule-judgment.svg?branch=main\n[travis-url]: https://travis-ci.com/kenote/rule-judgment\n[licensed-image]: https://img.shields.io/badge/license-MIT-blue.svg\n[licensed-url]: https://github.com/kenote/rule-judgment/blob/main/LICENSE","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkenote%2Frule-judgment","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkenote%2Frule-judgment","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkenote%2Frule-judgment/lists"}