{"id":24553970,"url":"https://github.com/kinogam/ts-rules","last_synced_at":"2026-01-31T21:11:18.321Z","repository":{"id":57381134,"uuid":"69166022","full_name":"kinogam/ts-rules","owner":"kinogam","description":"Typescript JSON validator","archived":false,"fork":false,"pushed_at":"2017-07-29T13:42:55.000Z","size":55,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-29T21:26:25.823Z","etag":null,"topics":["json","typescript","validator"],"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/kinogam.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":"2016-09-25T13:29:09.000Z","updated_at":"2019-09-12T08:48:30.000Z","dependencies_parsed_at":"2022-09-26T16:41:51.131Z","dependency_job_id":null,"html_url":"https://github.com/kinogam/ts-rules","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/kinogam/ts-rules","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kinogam%2Fts-rules","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kinogam%2Fts-rules/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kinogam%2Fts-rules/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kinogam%2Fts-rules/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kinogam","download_url":"https://codeload.github.com/kinogam/ts-rules/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kinogam%2Fts-rules/sbom","scorecard":{"id":560933,"data":{"date":"2025-08-11","repo":{"name":"github.com/kinogam/ts-rules","commit":"f656440e851ba8eee53fe0cfaf25bd15335b2918"},"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":"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":"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":"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":"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":"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"}},{"name":"Vulnerabilities","score":0,"reason":"38 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-fwr7-v2mv-hh25","Warn: Project is vulnerable to: GHSA-qwcr-r2fm-qrc7","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x","Warn: Project is vulnerable to: GHSA-9vvw-cc9w-f27h","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-h6ch-v84p-w6p9","Warn: Project is vulnerable to: GHSA-j4f2-536g-r55m","Warn: Project is vulnerable to: GHSA-r7qp-cfhv-p84w","Warn: Project is vulnerable to: GHSA-7x7c-qm48-pq9c","Warn: Project is vulnerable to: GHSA-rc3x-jf5g-xvc5","Warn: Project is vulnerable to: GHSA-fvqr-27wr-82fm","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-82v2-mx6x-wq7q","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-q75g-2496-mxpp","Warn: Project is vulnerable to: GHSA-6fx8-h7jm-663j","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-fxwf-4rqh-v8g3","Warn: Project is vulnerable to: GHSA-25hc-qcg6-38wj","Warn: Project is vulnerable to: GHSA-xfhh-g9f5-x4m4","Warn: Project is vulnerable to: GHSA-qm95-pgcg-qqfq","Warn: Project is vulnerable to: GHSA-cqmj-92xf-r6r9","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6","Warn: Project is vulnerable to: GHSA-mgfv-m47x-4wqp","Warn: Project is vulnerable to: GHSA-5v72-xg48-5rpm","Warn: Project is vulnerable to: GHSA-72mh-269x-7mh5","Warn: Project is vulnerable to: GHSA-h4j5-c7cj-74xg"],"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-20T13:39:07.724Z","repository_id":57381134,"created_at":"2025-08-20T13:39:07.724Z","updated_at":"2025-08-20T13:39:07.724Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28955277,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-31T18:30:42.805Z","status":"ssl_error","status_checked_at":"2026-01-31T18:30:19.593Z","response_time":128,"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":["json","typescript","validator"],"created_at":"2025-01-23T02:16:57.026Z","updated_at":"2026-01-31T21:11:18.289Z","avatar_url":"https://github.com/kinogam.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ts-rules\n\n[![Build Status](https://travis-ci.org/kinogam/ts-rules.svg?branch=master)](https://travis-ci.org/kinogam/ts-rules)\n\nA powerful JSON validator that design to validate complex JSON object.\n\n# How to install\n\n```sh \nnpm install ts-rules --save\n```\n\n# How to use\n\nes6 import\n```javascript\nimport {rules} from 'ts-rules';\n```\n\n\n# Simple\n\n```javascript\nlet r = rules({\n  p1: 'required | maxLen: 5',\n  p2: 'eq: {{p1}}'\n});\n\nlet result = r({\n  p1: '123456',\n  p2: ''\n});\n\nresult.valid; //false\n\nresult = r({\n  p1: '12345',\n  p2: '12345'\n});\n\nresult.valid; //true\n``` \n\n\n\n# Rules\n\nrequired\n```javascript\n{\n    'propName': 'required'\n}\n```\n\nnumber\n```javascript\n{\n    'propName': 'number'\n}\n```\n\nemail\n```javascript\n{\n    'propName': 'email'\n}\n```\nmax length\n```javascript\n{\n    'propName': 'maxLen: 8'\n}\n```\n\neq\n```javascript\n// equal\n{\n    'propName': `eq: 'kino'`\n}\n```\ngt \n```javascript\n// greater than\n{\n    'propName': `gt: 23`\n}\n```\n\ngte\n```javascript\n// greater than or equal to\n{\n    'propName': `gte: 23`\n}\n```\nlt\n```javascript\n// less than\n{\n    'propName': `lt: 23`\n}\n```\nlte\n```javascript\n// less than or equal to\n{\n    'propName': `lte: 23`\n}\n```\n\n# custom rule\n\n```javascript\nr = rules({\n    p: 'myRule: \"kinogam\"'\n});\n\n\nr.register('myRule', (val, name) =\u003e {\n    return val.indexOf(name) !== -1;\n});\n\njson = {\n    p: 'hello, kinogam!'\n};\n\nr(json).valid; // true\n```\n\n# multiple rules\nuse | to separate rules\n```javascript\nr = rules({\n    p: 'email | maxLen: 14'\n});\n\njson = {\n    p: 'kino@gmail.com'\n};\n\nr(json).valid; // true\n\njson = {\n    p: 'kinogam@gmail.com'\n};\n\nr(json).valid; // false\n```\n\n# wildcard *\nyou can use * as a wildcard to match all fields\n```javascript\nr = rules({\n    '*': 'required'\n});\n\njson = {\n    p1: 'hello',\n    p2: 'world'\n};\n\nr(json).valid; // true\n\njson = {\n    p1: 'hello',\n    p2: ''\n};\n\nr(json).valid; // false\n```\n\n# validation info\n\nwhen you use rFn(json) then will return a validation result\n\n```javascript\nresult.valid;\n```\n\nyou also can see each field's validation info\n```javascript\nr = rules({\n    p1: 'required',\n    p2: 'required'\n});\n\njson = {\n    p1: 'kino',\n    p2: ''\n};\n\nlet result = r(json);\n\nresult.fields.p1.invalid; // false\nresult.fields.p2.invalid; // true;\n```\n\nand you can set error message, the 'labels' property is optional\n```javascript\nlet info = {\n    labels: {\n        p1: 'my field',\n        p2: 'your field'\n    },\n    message: {\n        p1: {\n            'required': '{{p1}} is required',\n            'maxLen': '{{p1}} can not longer than 5 characters'\n        },\n        p2: {\n            'eq': '{{p2}} must equal to {{p1}}'\n        }\n    }\n};\n\nr = rules({\n    p1: 'required | maxLen: 5',\n    p2: 'eq: {{p1}}'\n}, info);\n\njson = {\n    p1: '',\n    p2: ''\n};\n\nlet result = r(json);\n\nresult.fields.p1.message; // 'my field is required'\n\njson = {\n    p1: '123456',\n    p2: ''\n};\n\nresult = r(json);\n\nresult.fields.p1.message; // 'my field can not longer than 5 characters'\n\njson = {\n    p1: '123',\n    p2: '234'\n};\n\nresult = r(json);\n\nresult.fields.p2.message; // 'your field must equal to my field';\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkinogam%2Fts-rules","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkinogam%2Fts-rules","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkinogam%2Fts-rules/lists"}