{"_id":"@ahmttyydn/validation","_rev":"7-21abe0e14588eaba7406b52303362e7f","name":"@ahmttyydn/validation","dist-tags":{"latest":"1.0.9"},"versions":{"1.0.0":{"name":"@ahmttyydn/validation","version":"1.0.0","keywords":["validation","coerce","scalar"],"author":{"url":"https://github.com/scalar","name":"Scalar"},"license":"MIT","_id":"@ahmttyydn/validation@1.0.0","maintainers":[{"name":"ahmttyydn","email":"ahmttyydn@gmail.com"}],"homepage":"https://github.com/scalar/scalar","bugs":{"url":"https://github.com/scalar/scalar/issues/new/choose"},"dist":{"shasum":"7c26b46f731efdf26e4e21b752fe34f62430167d","tarball":"https://registry.npmjs.org/@ahmttyydn/validation/-/validation-1.0.0.tgz","fileCount":41,"integrity":"sha512-CBkF4ZgZTvSL903C5k0I+xjPy1R1wsZ/8HRk+qDisKLPTnmhSL6mTcQcwaQfV1XXsJyF+7JzN2JCuWTw9GNOjw==","signatures":[{"sig":"MEUCIQDLyb7bDUD6Df/wRp4PB+UMudFWtnMb9B2aLTduev3+oAIgHv8e83f1BA29/3yeHdyjXwA4DaxD3oXaUQHWVDxOr8I=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":150660},"type":"module","_from":"file:ahmttyydn-validation-1.0.0.tgz","engines":{"node":">=20"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"scripts":{"dev":"tsx playground/index.ts","test":"vitest","build":"tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json","types:check":"tsc --noEmit"},"_npmUser":{"name":"ahmttyydn","email":"ahmttyydn@gmail.com"},"_resolved":"/private/var/folders/6s/_0b0836n1t9dc5prz2rp43h80000gn/T/bd42dfdb7c252bb8619482a8127286d5/ahmttyydn-validation-1.0.0.tgz","_integrity":"sha512-CBkF4ZgZTvSL903C5k0I+xjPy1R1wsZ/8HRk+qDisKLPTnmhSL6mTcQcwaQfV1XXsJyF+7JzN2JCuWTw9GNOjw==","repository":{"url":"git+https://github.com/scalar/scalar.git","type":"git","directory":"packages/validation"},"_npmVersion":"11.6.2","description":"A lightweight, schema-first validation library for Scalar","directories":{},"_nodeVersion":"24.11.1","_hasShrinkwrap":false,"devDependencies":{"vite":"8.0.0","vitest":"4.1.0"},"_npmOperationalInternal":{"tmp":"tmp/validation_1.0.0_1775418657379_0.8659029452097851","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@ahmttyydn/validation","version":"1.0.1","keywords":["validation","coerce","scalar"],"author":{"url":"https://github.com/scalar","name":"Scalar"},"license":"MIT","_id":"@ahmttyydn/validation@1.0.1","maintainers":[{"name":"ahmttyydn","email":"ahmttyydn@gmail.com"}],"homepage":"https://github.com/ahmtydn/scalar","bugs":{"url":"https://github.com/ahmtydn/scalar/issues/new/choose"},"dist":{"shasum":"974e95bd75e4b6d78e66b169001c15f4dff55b75","tarball":"https://registry.npmjs.org/@ahmttyydn/validation/-/validation-1.0.1.tgz","fileCount":40,"integrity":"sha512-cO+d6LWkVzUr5DSDcySaZvLjN4c1udtdtaTyIv0NVcg20Xthf34k9gsFtgaWY/e0OBFukk+jmsEPCs6O+xrJbQ==","signatures":[{"sig":"MEUCIQCY9hQDD7LeOUFdcEc3VkArYHBleaFUxnx8pKWpbz8YsAIgDnepwu0MZZa4X4maKEe8CH7IqK0MpZBJLgtPDoo0kJg=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@ahmttyydn%2fvalidation@1.0.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":150531},"type":"module","_from":"file:ahmttyydn-validation-1.0.1.tgz","engines":{"node":">=20"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"scripts":{"dev":"tsx playground/index.ts","test":"vitest","build":"tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json","types:check":"tsc --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:8dbd635e-0e42-4513-88e6-33d811357e10"}},"_resolved":"/tmp/b4bb591a3442d94e7918bdf33df66ca9/ahmttyydn-validation-1.0.1.tgz","_integrity":"sha512-cO+d6LWkVzUr5DSDcySaZvLjN4c1udtdtaTyIv0NVcg20Xthf34k9gsFtgaWY/e0OBFukk+jmsEPCs6O+xrJbQ==","repository":{"url":"git+https://github.com/ahmtydn/scalar.git","type":"git","directory":"packages/validation"},"_npmVersion":"11.11.0","description":"A lightweight, schema-first validation library for Scalar","directories":{},"_nodeVersion":"24.14.1","_hasShrinkwrap":false,"devDependencies":{"vite":"8.0.0","vitest":"4.1.0"},"_npmOperationalInternal":{"tmp":"tmp/validation_1.0.1_1775438240334_0.09156146228715878","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@ahmttyydn/validation","version":"1.0.2","keywords":["validation","coerce","scalar"],"author":{"url":"https://github.com/scalar","name":"Scalar"},"license":"MIT","_id":"@ahmttyydn/validation@1.0.2","maintainers":[{"name":"ahmttyydn","email":"ahmttyydn@gmail.com"}],"homepage":"https://github.com/ahmtydn/scalar","bugs":{"url":"https://github.com/ahmtydn/scalar/issues/new/choose"},"dist":{"shasum":"f05b2c7cb7693b6e8a2ac0d3037a23085a129b2a","tarball":"https://registry.npmjs.org/@ahmttyydn/validation/-/validation-1.0.2.tgz","fileCount":40,"integrity":"sha512-SnnHpLmOTTENFMtemZKYMF6FEbidHPsHLiaa4aQu3vVt5wlZ4ZOiFdKgUxkWjY3I9OVzIMD6TcCm67fVj/wzTA==","signatures":[{"sig":"MEUCIQDajeCyY8tKiqx4KSTVRMUlJyPPNFvUg2Zo0MbyTd1pggIgVZqDffKu75DyDT++YPNgF483PoFSqBC6Q3PFhMKAOLA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@ahmttyydn%2fvalidation@1.0.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":150531},"type":"module","_from":"file:ahmttyydn-validation-1.0.2.tgz","engines":{"node":">=20"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"scripts":{"dev":"tsx playground/index.ts","test":"vitest","build":"tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json","types:check":"tsc --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:8dbd635e-0e42-4513-88e6-33d811357e10"}},"_resolved":"/tmp/564a95f16cc90d151a39f124fbfaae0c/ahmttyydn-validation-1.0.2.tgz","_integrity":"sha512-SnnHpLmOTTENFMtemZKYMF6FEbidHPsHLiaa4aQu3vVt5wlZ4ZOiFdKgUxkWjY3I9OVzIMD6TcCm67fVj/wzTA==","repository":{"url":"git+https://github.com/ahmtydn/scalar.git","type":"git","directory":"packages/validation"},"_npmVersion":"11.11.0","description":"A lightweight, schema-first validation library for Scalar","directories":{},"_nodeVersion":"24.14.1","_hasShrinkwrap":false,"devDependencies":{"vite":"8.0.0","vitest":"4.1.0"},"_npmOperationalInternal":{"tmp":"tmp/validation_1.0.2_1775439087511_0.4419376192989348","host":"s3://npm-registry-packages-npm-production"}},"1.0.4":{"name":"@ahmttyydn/validation","version":"1.0.4","keywords":["validation","coerce","scalar"],"author":{"url":"https://github.com/scalar","name":"Scalar"},"license":"MIT","_id":"@ahmttyydn/validation@1.0.4","maintainers":[{"name":"ahmttyydn","email":"ahmttyydn@gmail.com"}],"homepage":"https://github.com/ahmtydn/scalar","bugs":{"url":"https://github.com/ahmtydn/scalar/issues/new/choose"},"dist":{"shasum":"fa8d9962ec23b945746e8aa9606825b1c260e345","tarball":"https://registry.npmjs.org/@ahmttyydn/validation/-/validation-1.0.4.tgz","fileCount":40,"integrity":"sha512-zUD+hqggiMvEvAxAYvHpfu5Rv0reA66yq6/9CHabzKqI1qs0TfIJWMPq/Ckeempa0S67lrTXzCZ7ww78R93QuQ==","signatures":[{"sig":"MEUCIQCPwUVF9FD9D/tGmcgj8Wm6qnFNpMfNek/EnSg8AJ1dcQIgEO8i0GpNUHvX2hnPss73CBnu7aNVJmOI7Egw/U/kEjs=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@ahmttyydn%2fvalidation@1.0.4","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":150531},"type":"module","_from":"file:ahmttyydn-validation-1.0.4.tgz","engines":{"node":">=20"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"scripts":{"dev":"tsx playground/index.ts","test":"vitest","build":"tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json","types:check":"tsc --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:8dbd635e-0e42-4513-88e6-33d811357e10"}},"_resolved":"/tmp/6f101f455aeee63da1dec1a2a367e149/ahmttyydn-validation-1.0.4.tgz","_integrity":"sha512-zUD+hqggiMvEvAxAYvHpfu5Rv0reA66yq6/9CHabzKqI1qs0TfIJWMPq/Ckeempa0S67lrTXzCZ7ww78R93QuQ==","repository":{"url":"git+https://github.com/ahmtydn/scalar.git","type":"git","directory":"packages/validation"},"_npmVersion":"11.11.0","description":"A lightweight, schema-first validation library for Scalar","directories":{},"_nodeVersion":"24.14.1","_hasShrinkwrap":false,"devDependencies":{"vite":"8.0.0","vitest":"4.1.0"},"_npmOperationalInternal":{"tmp":"tmp/validation_1.0.4_1775440996283_0.6943255085049398","host":"s3://npm-registry-packages-npm-production"}},"1.0.6":{"name":"@ahmttyydn/validation","version":"1.0.6","keywords":["validation","coerce","scalar"],"author":{"url":"https://github.com/scalar","name":"Scalar"},"license":"MIT","_id":"@ahmttyydn/validation@1.0.6","maintainers":[{"name":"ahmttyydn","email":"ahmttyydn@gmail.com"}],"homepage":"https://github.com/ahmtydn/scalar","bugs":{"url":"https://github.com/ahmtydn/scalar/issues/new/choose"},"dist":{"shasum":"a0b78b2e7d15c722bc0cb6c262f156830d7bfaaa","tarball":"https://registry.npmjs.org/@ahmttyydn/validation/-/validation-1.0.6.tgz","fileCount":40,"integrity":"sha512-XjbN+IAe2gXaKIsijfghGojuJsX6Eys7XmuNSzVyQDDVziBKKWPPuHxMHmdySAePlMWQ20UlslTE8a8L37Uv2A==","signatures":[{"sig":"MEUCIFlbsbAlHW4nKhYFlsj6zuaq+tuLEPaEX6bb2mUyHzs6AiEAnssHzyVqUBjt9a7MKntRU+2pc4LKTnz8T7iQnalrH5k=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@ahmttyydn%2fvalidation@1.0.6","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":150531},"type":"module","_from":"file:ahmttyydn-validation-1.0.6.tgz","engines":{"node":">=20"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"scripts":{"dev":"tsx playground/index.ts","test":"vitest","build":"tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json","types:check":"tsc --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:8dbd635e-0e42-4513-88e6-33d811357e10"}},"_resolved":"/tmp/ee211c843972bc06176599ab42c48151/ahmttyydn-validation-1.0.6.tgz","_integrity":"sha512-XjbN+IAe2gXaKIsijfghGojuJsX6Eys7XmuNSzVyQDDVziBKKWPPuHxMHmdySAePlMWQ20UlslTE8a8L37Uv2A==","repository":{"url":"git+https://github.com/ahmtydn/scalar.git","type":"git","directory":"packages/validation"},"_npmVersion":"11.11.0","description":"A lightweight, schema-first validation library for Scalar","directories":{},"_nodeVersion":"24.14.1","_hasShrinkwrap":false,"devDependencies":{"vite":"8.0.0","vitest":"4.1.0"},"_npmOperationalInternal":{"tmp":"tmp/validation_1.0.6_1775488362622_0.9730941879403916","host":"s3://npm-registry-packages-npm-production"}},"1.0.8":{"name":"@ahmttyydn/validation","version":"1.0.8","keywords":["validation","coerce","scalar"],"author":{"url":"https://github.com/scalar","name":"Scalar"},"license":"MIT","_id":"@ahmttyydn/validation@1.0.8","maintainers":[{"name":"ahmttyydn","email":"ahmttyydn@gmail.com"}],"homepage":"https://github.com/ahmtydn/scalar","bugs":{"url":"https://github.com/ahmtydn/scalar/issues/new/choose"},"dist":{"shasum":"f8196c142fd75f3a118903a3c7993b54db2243cf","tarball":"https://registry.npmjs.org/@ahmttyydn/validation/-/validation-1.0.8.tgz","fileCount":40,"integrity":"sha512-PqE3By6gCckjeFB43EUKybpr6N/mhyBpyPMgWhtrdOogS2EQktdRvhdFqt+xr7CMpAscQ8x0+82p7GpAPr+9yQ==","signatures":[{"sig":"MEUCIQC3pziuU1WAAl41cRCptGyXUE7G2FuGxeEQKqT9KrWk0gIgLLl1eWSaETDk1EVpnZitD3HyfgSmqsk003CeUSTGb6A=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@ahmttyydn%2fvalidation@1.0.8","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":150531},"type":"module","_from":"file:ahmttyydn-validation-1.0.8.tgz","engines":{"node":">=20"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"scripts":{"dev":"tsx playground/index.ts","test":"vitest","build":"tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json","types:check":"tsc --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:8dbd635e-0e42-4513-88e6-33d811357e10"}},"_resolved":"/tmp/21d54a488b9efe2765924b39ea0d99f1/ahmttyydn-validation-1.0.8.tgz","_integrity":"sha512-PqE3By6gCckjeFB43EUKybpr6N/mhyBpyPMgWhtrdOogS2EQktdRvhdFqt+xr7CMpAscQ8x0+82p7GpAPr+9yQ==","repository":{"url":"git+https://github.com/ahmtydn/scalar.git","type":"git","directory":"packages/validation"},"_npmVersion":"11.11.0","description":"A lightweight, schema-first validation library for Scalar","directories":{},"_nodeVersion":"24.14.1","_hasShrinkwrap":false,"devDependencies":{"vite":"8.0.0","vitest":"4.1.0"},"_npmOperationalInternal":{"tmp":"tmp/validation_1.0.8_1775513298577_0.5204054638967752","host":"s3://npm-registry-packages-npm-production"}},"1.0.9":{"name":"@ahmttyydn/validation","description":"A lightweight, schema-first validation library for Scalar","license":"MIT","author":{"name":"Scalar","url":"https://github.com/scalar"},"homepage":"https://github.com/ahmtydn/scalar","bugs":{"url":"https://github.com/ahmtydn/scalar/issues/new/choose"},"repository":{"type":"git","url":"git+https://github.com/ahmtydn/scalar.git","directory":"packages/validation"},"keywords":["validation","coerce","scalar"],"version":"1.0.9","engines":{"node":">=20"},"type":"module","exports":{".":{"import":"./dist/index.js","types":"./dist/index.d.ts","default":"./dist/index.js"}},"devDependencies":{"vite":"8.0.0","vitest":"4.1.0"},"scripts":{"build":"tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json","dev":"tsx playground/index.ts","test":"vitest","types:check":"tsc --noEmit"},"_id":"@ahmttyydn/validation@1.0.9","_integrity":"sha512-MESp7/vhmABs84K30q1wJuES/J1Gn6yGpzjxfxz0c+Yfe42UHUqrT9OQtKhFK8qNtkLwJ/Q2dHes+UlgQwEwwg==","_resolved":"/tmp/5cb4f8eaf8db2b060fbfb9672aa0886b/ahmttyydn-validation-1.0.9.tgz","_from":"file:ahmttyydn-validation-1.0.9.tgz","_nodeVersion":"24.14.1","_npmVersion":"11.11.0","dist":{"integrity":"sha512-MESp7/vhmABs84K30q1wJuES/J1Gn6yGpzjxfxz0c+Yfe42UHUqrT9OQtKhFK8qNtkLwJ/Q2dHes+UlgQwEwwg==","shasum":"d012511cb6f6d247049cffc84ec14f67f54186fe","tarball":"https://registry.npmjs.org/@ahmttyydn/validation/-/validation-1.0.9.tgz","fileCount":40,"unpackedSize":150531,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@ahmttyydn%2fvalidation@1.0.9","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIFjK86FQsRGP3zdRFnyphxIlLaKSlkWbYfKCYA96gV8GAiEA8bcr0KInHkwD4cfRfG/FpUNio90aOCEmZ2zWYcayMzs="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:8dbd635e-0e42-4513-88e6-33d811357e10"}},"directories":{},"maintainers":[{"name":"ahmttyydn","email":"ahmttyydn@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/validation_1.0.9_1775514611212_0.7717512291047082"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-05T19:50:57.248Z","modified":"2026-04-06T22:30:11.626Z","1.0.0":"2026-04-05T19:50:57.510Z","1.0.1":"2026-04-06T01:17:20.474Z","1.0.2":"2026-04-06T01:31:27.649Z","1.0.4":"2026-04-06T02:03:16.446Z","1.0.6":"2026-04-06T15:12:42.775Z","1.0.8":"2026-04-06T22:08:18.734Z","1.0.9":"2026-04-06T22:30:11.356Z"},"bugs":{"url":"https://github.com/ahmtydn/scalar/issues/new/choose"},"author":{"name":"Scalar","url":"https://github.com/scalar"},"license":"MIT","homepage":"https://github.com/ahmtydn/scalar","keywords":["validation","coerce","scalar"],"repository":{"type":"git","url":"git+https://github.com/ahmtydn/scalar.git","directory":"packages/validation"},"description":"A lightweight, schema-first validation library for Scalar","maintainers":[{"name":"ahmttyydn","email":"ahmttyydn@gmail.com"}],"readme":"# `@ahmttyydn/validation`\n\nSmall, schema-first helpers to **check** unknown data and **coerce** it into predictable shapes. Schemas are plain JavaScript objects (easy to serialize or log), and TypeScript can infer output types with `Static`.\n\n## Install\n\nThis package lives in the Scalar monorepo. In workspace consumers:\n\n```bash\npnpm add @ahmttyydn/validation\n```\n\n## Quick start\n\n```ts\nimport { coerce, number, object, string, validate, type Static } from '@ahmttyydn/validation'\n\nconst userSchema = object({\n  id: number(),\n  name: string(),\n})\n\ntype User = Static<typeof userSchema>\n\nvalidate(userSchema, { id: 1, name: 'Ada' }) // true\nvalidate(userSchema, { id: 1, name: 2 }) // false\n\n// Best-effort shaping: invalid primitives fall back to defaults\ncoerce(userSchema, { id: 'x', name: 'Ada' }) // { id: 0, name: 'Ada' }\n```\n\n## Concepts\n\n### `validate(schema, value)`\n\nReturns `true` if `value` satisfies `schema`, otherwise `false`.\n\n- **`undefined` schema** — always fails.\n- **`number()`** — finite numbers only (`NaN` and `Infinity` fail).\n- **`object({ ... })`** — value must be a **plain object** (see [Objects and records](#objects-and-records)). Each declared property is validated; **extra properties are not rejected**.\n- **`union([...])`** — matches if **any** branch matches.\n\n### `coerce(schema, value)`\n\nReturns a value typed as `Static<typeof schema>`. It is **not** strict validation: it **normalizes** toward the schema.\n\n- Valid primitives are returned as-is.\n- Invalid **number** → `0`, invalid **string** → `''`, invalid **boolean** → `false`.\n- **`nullable()`** — result is always `null`.\n- **`notDefined()`** — result is always `undefined`.\n- **`literal(x)`** — result is always the schema’s literal `x` (the declared constant).\n- **`array` / `object` / `record`** — built recursively; wrong shapes become empty containers or defaulted fields.\n- **`union`** — picks a branch using a **scoring** heuristic (object shape and literal tags weigh more than “property exists”).\n- Optional third argument: internal **`WeakMap` cache** for cyclic graphs; you normally omit it.\n\nUse **`validate`** when you need a yes/no. Use **`coerce`** when you want a stable default-filled structure (for example normalizing config or parsed JSON).\n\n## Schema builders\n\n| Builder | Validates | `Static` type (idea) |\n|--------|-----------|----------------------|\n| `number()` | Finite `number` | `number` |\n| `string()` | `string` | `string` |\n| `boolean()` | `boolean` | `boolean` |\n| `nullable()` | `null` only | `null` |\n| `notDefined()` | `undefined` only | `undefined` |\n| `any()` | Anything | `any` |\n| `literal(v)` | Strict equality to `v` | `typeof v` |\n| `array(item)` | Array; every item matches `item` | `Static<item>[]` |\n| `record(key, value)` | Plain object; keys and values match | `Record<…, …>` |\n| `object(props)` | Plain object; each key in `props` | Object of static fields |\n| `union([a, b, …])` | Matches any member | Union of branches |\n| `optional(s)` | `undefined` or matches `s` | `Static<s> \\| undefined`; in `object({ … })`, property becomes `key?: Static<s>` |\n| `lazy(() => schema)` | Defers schema (recursion) | Inferred from inner schema |\n| `evaluate(fn, schema)` | Runs `fn(value)` then validates `schema` | `Static<schema>` |\n\n```ts\nimport { lazy, object, string, union, literal } from '@ahmttyydn/validation'\n\n// Discriminated-style union\nconst message = union([\n  object({ type: literal('text'), body: string() }),\n  object({ type: literal('ping') }),\n])\n```\n\n### `evaluate` — parse then validate\n\n```ts\nimport { evaluate, number, string } from '@ahmttyydn/validation'\n\nconst trimmed = evaluate((v) => (typeof v === 'string' ? v.trim() : v), string())\n\nvalidate(trimmed, '  hi  ') // true (after trim)\n```\n\n## Objects and records\n\n**Plain object** means: not `null`, and prototype is `Object.prototype` or `null`. Arrays, `Date`, and most class instances **do not** count as objects for `object()` / `record()` validation.\n\n**`object`** checks only the keys you list. Missing keys are read as `undefined`, so pair them with `optional(...)` when a field may be absent.\n\n**`record`** during **validation** checks every key against the key schema and every value against the value schema. During **coercion**, entries keep their string keys as-is and only values are coerced.\n\n## TypeScript: `Static` and `Schema`\n\n- **`Static<S>`** — inferred TypeScript type for data that matches schema `S` (depth-limited to avoid infinite recursion on very deep types).\n- **`Schema`** — union of all schema shapes; use when you store or pass schemas around.\n\n## Development\n\n```bash\npnpm --filter @ahmttyydn/validation test\npnpm --filter @ahmttyydn/validation types:check\npnpm --filter @ahmttyydn/validation build\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md"}