{"id":21813477,"url":"https://github.com/sankooc/validatez","last_synced_at":"2026-05-13T12:39:53.721Z","repository":{"id":57390301,"uuid":"75648323","full_name":"sankooc/validatez","owner":"sankooc","description":"object validation for node","archived":false,"fork":false,"pushed_at":"2017-05-25T09:29:11.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-09T19:38:22.006Z","etag":null,"topics":["data","validate"],"latest_commit_sha":null,"homepage":null,"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/sankooc.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-12-05T17:11:37.000Z","updated_at":"2017-04-13T09:19:58.000Z","dependencies_parsed_at":"2022-09-12T22:53:12.301Z","dependency_job_id":null,"html_url":"https://github.com/sankooc/validatez","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sankooc/validatez","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sankooc%2Fvalidatez","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sankooc%2Fvalidatez/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sankooc%2Fvalidatez/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sankooc%2Fvalidatez/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sankooc","download_url":"https://codeload.github.com/sankooc/validatez/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sankooc%2Fvalidatez/sbom","scorecard":{"id":799768,"data":{"date":"2025-08-11","repo":{"name":"github.com/sankooc/validatez","commit":"928b72bf39b8fdecc1abb850c932980125f8a826"},"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":"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":"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":"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":"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/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":"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":"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":"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-23T10:06:18.739Z","repository_id":57390301,"created_at":"2025-08-23T10:06:18.739Z","updated_at":"2025-08-23T10:06:18.739Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280755317,"owners_count":26385096,"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-24T02:00:06.418Z","response_time":73,"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":["data","validate"],"created_at":"2024-11-27T14:29:31.367Z","updated_at":"2025-10-24T06:49:53.370Z","avatar_url":"https://github.com/sankooc.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# validatez\n\n[![NPM](https://nodei.co/npm/validatez.png?downloads=true\u0026downloadRank=true\u0026stars=true)](https://nodei.co/npm/validatez/)\n\n![travis](https://travis-ci.org/sankooc/validatez.svg?branch=master)\n![dm](https://img.shields.io/npm/dm/validatez.svg)\n![version](https://img.shields.io/npm/v/validatez.svg)\n\nsimple way to validate object\n\n## install\n\n`$ npm install validatez`\n\n## base usage\n\n```\nconst creator = require('validatez');\n\nconst schema = {\n  name: {\n    type: String,\n    errMessage: (type, val) =\u003e\n      `error occur ${type}-${val}`\n    ,\n  },\n  age: {\n    type: Number,\n    range: [1, 100],\n    errMessage: 'age incorrect',\n    required: false,\n  },\n};\n\nconst validator = creator.create(schema);\n\nlet data = {\n  name: 'atom',\n}\nvalidator(data); // pass\n\ndata = {\n  name: 'atom',\n  age: 200,\n}\nvalidator(data); // throw exception\n\n```\n\n\n## type refer\n\n```\nconst schema = {\n  address: {\n    type: String,\n    pattern: /^\\w{10}$/,\n  },\n  address2: {\n    type: '\u0026address', // \u0026 + field to refer existed schema\n  },\n};\n\nconst validator = validate.create(schema);\n\nlet data = {\n  address: 'china beijing bejing',\n  address2: 'bejing chaoyangqu chaoyangbeilu',\n}\nvalidator(data); // pass\n\n```\n\n## buildin types\n\nall buildin type start with `@`\n\n```\n\nconst schema = {\n  email: {\n    type: '@email',\n  },\n};\nconst validator = validate.create(schema);\n\nlet data = {\n  email: 'sankooc@scd.com',\n}\nvalidator(data); // pass\n\n```\n\n all buildin types [HERE](doc/types.md)\n\n if you need more buildin types, create [ISSUE](https://github.com/sankooc/validatez/issues/new)\n\n also you can define or override buildin type\n\n ```\n validate.register({\n   code: {\n     type: String,\n     pattern: /^\\d{16}$/,\n   }\n })\n\n const schema = {\n   zcode: {\n     type: '@code'\n   },\n };\n validator = validate.create(schema);\n\n data = {\n   zcode: '1234123412341234',\n };\n\n validator(data); //pass\n\n ```\n\n## simple define\n\n```\n\nconst schema = {\n  email: '@email',\n  name: String,\n};\nconst validator = validate.create(schema);\n\nlet data = {\n  email: 'sankooc@scd.com',\n  name: 'sankooc',\n}\nvalidator(data); // pass\n\n\n```\n\n\n\n## simple inject for control flow\n\n### if your code managed by `Promise` your code will be like below\n\n```\n\nfunction process(data){\n  // next\n}\ngetSomeData().then(process)\n\n```\n\n### add data validation\n\n```\n\nconst schema = {\n  address: {\n    type: String,\n  },\n};\n\nconst option = {\n  errorType: Promise,\n}\nconst validator = validate.create(schema, option);\n\ngetSomeData().then(validator).then(process)\n\n```\n\n\n### if your code managed by `async` your code will be like below\n\n\n```\n\nfunction process(data, callback){\n  // next\n}\nasync.waterfall([getSomeData, process],callback);\n\n```\n\n### add data validation\n\n```\n\nconst schema = {\n  address: {\n    type: String,\n  },\n};\n\nconst option = {\n  errorType: Function,\n}\nconst validator = validate.create(schema, option);\n\nasync.waterfall([getSomeData, validator, process],callback);\n\n```\n\n\n## support string case\n\n```\n\nconst schema = {\n  userName: {\n    type: String,\n  },\n};\nconst option = {\n  field: 'snake' // snake, camel, kebab\n}\nconst validator = validate.create(schema, option);\n\nlet data = {\n  user_name: 'atom',\n}\nvalidator(data); // pass\n\n```\n\n## schema option\n\n| key       | type          |default value| desc                         |   \n|-----------|---------------|-------------|------------------------------|\n| type      |string/function|String       |                              |\n| required  |boolean        |false        |                              |\n| errMessage|string/function|`error param`| error message                |\n| range     |array          |             | enable when type is `Number` |\n| pattern   |regex          |             | enable when type is `String` |\n\n\n\n## valiate option\n\n| key     |type    |default value | desc             |\n|---------|--------|--------|------------------------|\n|handle   |string  |`error` | 'error'/'promise'/'callback' |\n|field    |string  |`strict`| snake/camel/kebab      |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsankooc%2Fvalidatez","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsankooc%2Fvalidatez","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsankooc%2Fvalidatez/lists"}