{"id":14155186,"url":"https://github.com/shimataro/value-schema","last_synced_at":"2026-01-12T02:21:33.970Z","repository":{"id":31874874,"uuid":"129598471","full_name":"shimataro/value-schema","owner":"shimataro","description":"simple, easy-to-use, and declarative input validator; supports Node.js, TypeScript, Deno, and Bun","archived":false,"fork":false,"pushed_at":"2025-01-04T08:54:51.000Z","size":3488,"stargazers_count":27,"open_issues_count":3,"forks_count":2,"subscribers_count":1,"default_branch":"v4","last_synced_at":"2025-11-15T20:44:16.718Z","etag":null,"topics":["bun","deno","javascript","nodejs","parameter","parameters","schema","typescript","validation","validator"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/value-schema","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/shimataro.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":["shimataro"],"custom":["https://www.paypal.me/shimataro"]}},"created_at":"2018-04-15T10:12:59.000Z","updated_at":"2025-03-02T01:36:18.000Z","dependencies_parsed_at":"2024-01-16T22:18:27.663Z","dependency_job_id":"02c16fbb-5809-44d9-8bcf-a47fa709a990","html_url":"https://github.com/shimataro/value-schema","commit_stats":{"total_commits":514,"total_committers":4,"mean_commits":128.5,"dds":0.08949416342412453,"last_synced_commit":"82a9fffaf334e3039217ec5e8828b813734ca97e"},"previous_names":["shimataro/node-adjuster"],"tags_count":63,"template":false,"template_full_name":null,"purl":"pkg:github/shimataro/value-schema","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shimataro%2Fvalue-schema","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shimataro%2Fvalue-schema/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shimataro%2Fvalue-schema/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shimataro%2Fvalue-schema/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shimataro","download_url":"https://codeload.github.com/shimataro/value-schema/tar.gz/refs/heads/v4","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shimataro%2Fvalue-schema/sbom","scorecard":{"id":818682,"data":{"date":"2025-08-11","repo":{"name":"github.com/shimataro/value-schema","commit":"3febbdc38a08ed8009e5d9dd0edcf26bfe4258b7"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.8,"checks":[{"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":"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":"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":"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":"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":"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":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/examples-linux.yml:1","Warn: no topLevel permission defined: .github/workflows/examples-macos.yml:1","Warn: no topLevel permission defined: .github/workflows/examples-windows.yml:1","Warn: no topLevel permission defined: .github/workflows/publish.yml:1","Warn: no topLevel permission defined: .github/workflows/reusable-bun.yml:1","Warn: no topLevel permission defined: .github/workflows/reusable-cjs.yml:1","Warn: no topLevel permission defined: .github/workflows/reusable-conditional-exports.yml:1","Warn: no topLevel permission defined: .github/workflows/reusable-deno.yml:1","Warn: no topLevel permission defined: .github/workflows/reusable-esm.yml:1","Warn: no topLevel permission defined: .github/workflows/reusable-typescript.yml:1","Warn: no topLevel permission defined: .github/workflows/verify.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":"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":"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":"Pinned-Dependencies","score":3,"reason":"dependency not pinned by hash detected -- score normalized to 3","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/shimataro/value-schema/publish.yml/v4?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/reusable-bun.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/shimataro/value-schema/reusable-bun.yml/v4?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/reusable-cjs.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/shimataro/value-schema/reusable-cjs.yml/v4?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/reusable-conditional-exports.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/shimataro/value-schema/reusable-conditional-exports.yml/v4?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/reusable-deno.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/shimataro/value-schema/reusable-deno.yml/v4?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/reusable-deno.yml:26: update your workflow using https://app.stepsecurity.io/secureworkflow/shimataro/value-schema/reusable-deno.yml/v4?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/reusable-esm.yml:27: update your workflow using https://app.stepsecurity.io/secureworkflow/shimataro/value-schema/reusable-esm.yml/v4?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/reusable-typescript.yml:26: update your workflow using https://app.stepsecurity.io/secureworkflow/shimataro/value-schema/reusable-typescript.yml/v4?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/verify.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/shimataro/value-schema/verify.yml/v4?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/verify.yml:30: update your workflow using https://app.stepsecurity.io/secureworkflow/shimataro/value-schema/verify.yml/v4?enable=pin","Warn: npmCommand not pinned by hash: scripts/update-dependencies.sh:27","Warn: npmCommand not pinned by hash: .github/workflows/reusable-cjs.yml:37","Warn: npmCommand not pinned by hash: .github/workflows/reusable-conditional-exports.yml:37","Warn: npmCommand not pinned by hash: .github/workflows/reusable-esm.yml:42","Warn: npmCommand not pinned by hash: .github/workflows/reusable-typescript.yml:41","Warn: npmCommand not pinned by hash: .github/workflows/reusable-typescript.yml:42","Info:   0 out of   8 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   2 third-party GitHubAction dependencies pinned","Info:   5 out of  11 npmCommand 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":"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":"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":"Branch-Protection","score":-1,"reason":"internal error: error during GetBranch(v3): error during branchesHandler.query: 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 30 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":8,"reason":"2 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw"],"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-23T14:49:37.471Z","repository_id":31874874,"created_at":"2025-08-23T14:49:37.471Z","updated_at":"2025-08-23T14:49:37.471Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28332023,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T00:36:25.062Z","status":"online","status_checked_at":"2026-01-12T02:00:08.677Z","response_time":98,"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":["bun","deno","javascript","nodejs","parameter","parameters","schema","typescript","validation","validator"],"created_at":"2024-08-17T08:02:25.510Z","updated_at":"2026-01-12T02:21:33.946Z","avatar_url":"https://github.com/shimataro.png","language":"TypeScript","funding_links":["https://github.com/sponsors/shimataro","https://www.paypal.me/shimataro"],"categories":["typescript"],"sub_categories":[],"readme":"# value-schema\n\n[![Build Status (Windows)][image-examples-windows]][link-examples-windows]\n[![Build Status (macOS)][image-examples-macos]][link-examples-macos]\n[![Build Status (Linux)][image-examples-linux]][link-examples-linux]\n[![Code Coverage][image-code-coverage]][link-code-coverage]\n[![Release][image-release]][link-release]\n[![Node.js version][image-engine]][link-engine]\n[![TypeScript version][image-typescript]][link-typescript]\n[![Deno version][image-deno]][link-deno]\n[![Bun version][image-bun]][link-bun]\n[![License][image-license]][link-license]\n\nsimple, easy-to-use, and declarative input validator\n\nsupports [Node.js](https://nodejs.org/), [TypeScript](https://www.typescriptlang.org/), [Deno](https://deno.land/), and [Bun](https://bun.sh/)\n\n* [migration guide](./docs/migration.md)\n* [reference](./docs/reference.md)\n\n## Table of Contents\n\n* [Introduction](#introduction)\n* [Install](#install)\n* [Loading](#loading)\n* [Changelog](#changelog)\n\n***\n\n## Introduction\n\nAll of web applications need handling input parameters, consists of following steps:\n\n1. existence check\n    * all required parameters exist?\n    * fill omittable parameters with default values\n1. type check\n    * e.g., `typeof age === \"number\"`\n    * cast them if needed; `\"20\"`(string) to `20`(number)\n1. domain check\n    * e.g., `1 \u003c= limit \u0026\u0026 limit \u003c= 100`\n    * revise them if needed; `0` to `1`\n\n`value-schema` does all of them, by compact and highly readable code!\n\n### example\n\n```javascript\nimport vs from \"value-schema\";\n\nconst schemaObject = { // schema for input\n    id: vs.number({ // number, \u003e=1\n        minValue: 1,\n    }),\n    name: vs.string({ // string, max 16 characters (trims if over)\n        maxLength: {\n            length: 16,\n            trims: true,\n        },\n    }),\n    birthday: vs.date(), // Date\n    age: vs.number({ // number, integer (rounds down toward zero), \u003e=0\n        integer: vs.NUMBER.INTEGER.FLOOR_RZ,\n        minValue: 0,\n    }),\n    email: vs.email(), // email\n    state: vs.string({ // string, accepts only \"active\" and \"inactive\"\n        only: [\"active\", \"inactive\"],\n    }),\n    classes: vs.array({ // array of number, separated by \",\", ignores errors\n        separatedBy: \",\",\n        each: {\n            schema: vs.number(),\n            ignoresErrors: true,\n        },\n    }),\n    skills: vs.array({ // array of string, separated by \",\", ignores errors\n        separatedBy: \",\",\n        each: {\n            schema: vs.string(),\n            ignoresErrors: true,\n        },\n    }),\n    creditCard: vs.numericString({ // numeric string, separated by \"-\", checks by Luhn algorithm\n        separatedBy: \"-\",\n        checksum: vs.NUMERIC_STRING.CHECKSUM_ALGORITHM.CREDIT_CARD,\n    }),\n    remoteAddr: vs.string({ // IPv4, mapped to \"remote_addr\" property\n        pattern: vs.STRING.PATTERN.IPV4,\n        map: \"remote_addr\",\n    }),\n    remoteAddrIpv6: vs.string({ // IPv6, mapped to \"remote-addr-ipv6\" property\n        pattern: vs.STRING.PATTERN.IPV6,\n        map: \"remote-addr-ipv6\",\n    }),\n    limit: vs.number({ // number, integer, omittable (sets 10 if omitted), \u003e=1 (sets 1 if less), \u003c=100 (sets 100 if greater)\n        ifUndefined: 10,\n        integer: true,\n        minValue: {\n            value: 1,\n            adjusts: true,\n        },\n        maxValue: {\n            value: 100,\n            adjusts: true,\n        },\n    }),\n    offset: vs.number({ // number, integer, omittable (sets 0 if omitted), \u003e=0 (sets 0 if less)\n        ifUndefined: 0,\n        integer: true,\n        minValue: {\n            value: 0,\n            adjusts: true,\n        },\n    }),\n};\nconst input = { // input values\n    id: \"1\",\n    name: \"Pablo Diego José Francisco de Paula Juan Nepomuceno María de los Remedios Ciprin Cipriano de la Santísima Trinidad Ruiz y Picasso\",\n    birthday: \"2000-01-02T03:04:05.678Z\",\n    age: 20.5,\n    email: \"picasso@example.com\",\n    state: \"active\",\n    classes: \"1,3,abc,4\",\n    skills: \"c,c++,javascript,python,,swift,kotlin\",\n    creditCard: \"4111-1111-1111-1111\",\n    remote_ddr: \"127.0.0.1\",\n    \"remote-addr-ipv6\": \"::1\",\n    limit: \"0\",\n};\nconst expected = { // should be transformed to this\n    id: 1,\n    name: \"Pablo Diego José\",\n    birthday: new Date(\"2000-01-02T03:04:05.678Z\"),\n    age: 20,\n    email: \"picasso@example.com\",\n    state: \"active\",\n    classes: [1, 3, 4],\n    skills: [\"c\", \"c++\", \"javascript\", \"python\", \"swift\", \"kotlin\"],\n    creditCard: \"4111111111111111\",\n    remoteAddr: \"127.0.0.1\",\n    remoteAddrIpv6: \"::1\",\n    limit: 1,\n    offset: 0,\n};\n\n// Let's apply!\nconst actual = vs.applySchemaObject(schemaObject, input);\n\n// verification\nassert.deepStrictEqual(actual, expected);\n```\n\nThat's all! No control flows! Isn't it cool?\n\nFor details, see [reference](./docs/reference.md).\n\n## Install\n\ninstall from [npm registry](https://www.npmjs.com/package/value-schema).\n\n```bash\nnpm install -S value-schema\n```\n\n## Loading\n\n### CommonJS\n\n```javascript\n// foo.js\nvar vs = require(\"value-schema\");\n```\n\n### ES Modules / [Babel](https://babeljs.io/) / [TypeScript](https://www.typescriptlang.org/)\n\n```javascript\n// foo.mjs (ES Modules) / foo.js (Babel) / foo.ts (TypeScript)\nimport vs from \"value-schema\";\n```\n\n**ES Modules** has been supported as of Node.js v8.5.0.\nIn Windows, Node.js v8.6.0 is recommended due to [`ERR_INVALID_PROTOCOL`](https://github.com/nodejs/node/issues/15374).\n\nTo execute \"foo.mjs\", `--experimental-modules` flag is required.\n(the flag is dropped as of Node.js v13.2.0)\n\n```bash\n$ node --experimental-modules foo.mjs\n(node:25508) ExperimentalWarning: The ESM module loader is experimental.\n```\n\n**TypeScript** auto-completion and type-checking works perfectly on [Visual Studio Code](https://code.visualstudio.com/) and [IntelliJ IDEA](https://www.jetbrains.com/idea/)!\n\n### [Deno](https://deno.land/)\n\nDeno has been supported as of v3.\n\n```typescript\n// use latest version\nimport vs from \"https://deno.land/x/value_schema/mod.ts\";\n```\n\n```typescript\n// use specific version\nimport vs from \"https://deno.land/x/value_schema@v4.0.0-rc.2/mod.ts\";\n```\n\n**CAUTION**: specify `value_schema` (underscore) NOT `value-schema` (hyphen) because [deno.land](https://deno.land/) module database does not support name with hyphen!\n\n### [Bun](https://bun.sh/)\n\nBun has been supported as of v4, but might work v3 or earlier.\n\nUse just like a npm module.\n\n```typescript\nimport vs from \"value-schema\";\n```\n\n## Changelog\n\nSee [CHANGELOG.md](CHANGELOG.md).\n\n[image-examples-windows]: https://github.com/shimataro/value-schema/workflows/Windows/badge.svg?event=push\u0026branch=v4\n[link-examples-windows]: https://github.com/shimataro/value-schema/actions?query=workflow%3AWindows\n[image-examples-macos]: https://github.com/shimataro/value-schema/workflows/macOS/badge.svg?event=push\u0026branch=v4\n[link-examples-macos]: https://github.com/shimataro/value-schema/actions?query=workflow%3AmacOS\n[image-examples-linux]: https://github.com/shimataro/value-schema/workflows/Linux/badge.svg?event=push\u0026branch=v4\n[link-examples-linux]: https://github.com/shimataro/value-schema/actions?query=workflow%3ALinux\n[image-code-coverage]: https://img.shields.io/codecov/c/github/shimataro/value-schema/v4.svg\n[link-code-coverage]: https://codecov.io/gh/shimataro/value-schema\n[image-release]: https://img.shields.io/github/release/shimataro/value-schema.svg\n[link-release]: https://github.com/shimataro/value-schema/releases\n[image-engine]: https://img.shields.io/node/v/value-schema.svg\n[link-engine]: https://nodejs.org/\n[image-typescript]: https://img.shields.io/badge/TypeScript-%3E%3D3.5-brightgreen.svg\n[link-typescript]: https://www.typescriptlang.org/\n[image-deno]: https://img.shields.io/badge/%F0%9F%A6%95%20Deno-%3E%3D1.0.0-brightgreen\n[link-deno]: https://deno.land/\n[image-bun]: https://img.shields.io/badge/%F0%9F%A5%9F%20Bun-%3E%3D1.0.0-brightgreen\n[link-bun]: https://bun.sh/\n[image-license]: https://img.shields.io/github/license/shimataro/value-schema.svg\n[link-license]: ./LICENSE\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshimataro%2Fvalue-schema","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshimataro%2Fvalue-schema","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshimataro%2Fvalue-schema/lists"}