{"_id":"@antistructured/sigiljs","name":"@antistructured/sigiljs","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@antistructured/sigiljs","version":"0.1.0","description":"Runtime type sigils for JavaScript","keywords":["types","validation","runtime","schema","type-checking","zero-dependency","sigil","bun","javascript"],"repository":{"type":"git","url":"git+https://github.com/antistructured/sigiljs.git"},"license":"MIT","author":{"name":"Daniel Weipert","email":"weipertda@gmail.com"},"sideEffects":false,"type":"module","exports":{".":"./src/index.js"},"main":"./src/index.js","scripts":{"format":"prettier --write src/","lint":"eslint src/","test":"bun test","release:patch":"npm version patch && git push --follow-tags && npm publish --access public","release:minor":"npm version minor && git push --follow-tags && npm publish --access public","release:major":"npm version major && git push --follow-tags && npm publish --access public"},"engines":{"bun":">=1","node":">=18"},"gitHead":"d0db25b5c73e40df72245059611481b933e39422","_id":"@antistructured/sigiljs@0.1.0","bugs":{"url":"https://github.com/antistructured/sigiljs/issues"},"homepage":"https://github.com/antistructured/sigiljs#readme","_nodeVersion":"24.14.0","_npmVersion":"11.9.0","dist":{"integrity":"sha512-zajaZTcCwYC4fLUGoitkYmP//aoUAciLET6PJziH8hjUIcunifTaxBSLD7+LhFP4kqnLcQdBTuXW/XxAbMYWqA==","shasum":"ef5481070822a435780372b5bfdaf73fbe64df8b","tarball":"https://registry.npmjs.org/@antistructured/sigiljs/-/sigiljs-0.1.0.tgz","fileCount":19,"unpackedSize":41346,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCICsr8Zi8qHq8dX8T1I/uvLji8eZ9vXSmFJvZYV+6H5qDAiEAvUwISkQi38DK5jrJlRIMarVMyS/iKoTbBvlmyGnVvfk="}]},"_npmUser":{"name":"weipertda","email":"weipertda@gmail.com"},"directories":{},"maintainers":[{"name":"weipertda","email":"weipertda@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sigiljs_0.1.0_1773334805662_0.2309663347643427"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-12T17:00:05.543Z","0.1.0":"2026-03-12T17:00:05.810Z","modified":"2026-03-12T17:00:06.064Z"},"maintainers":[{"name":"weipertda","email":"weipertda@gmail.com"}],"description":"Runtime type sigils for JavaScript","homepage":"https://github.com/antistructured/sigiljs#readme","keywords":["types","validation","runtime","schema","type-checking","zero-dependency","sigil","bun","javascript"],"repository":{"type":"git","url":"git+https://github.com/antistructured/sigiljs.git"},"author":{"name":"Daniel Weipert","email":"weipertda@gmail.com"},"bugs":{"url":"https://github.com/antistructured/sigiljs/issues"},"license":"MIT","readme":"# SigilJS\n\nWrite types. Validate reality.\n\n## What is SigilJS?\n\nSigilJS is a tiny JavaScript library for describing and validating data using **sigils**.\n\nA sigil is a small expression (type expression) that describes what your data should look like.\n\nSigils are compiled into fast validators, so repeated checks stay efficient.\n\n\nNo TypeScript.\n\nNo dependencies.\n\nJust JavaScript.\n\n---\n\n## Installation\n\n```bash\n\nbun add @antistructured/sigiljs\n\n```\n\n– or –\n\n```bash\n\nnpm install @antistructured/sigiljs\n\n```\n\n---\n\n### Create a Sigil\n\n```javascript\n\nimport { Sigil } from \"@antistructured/sigiljs\"\n\nconst Email = Sigil`string`\n\n```\n\n### Validate a Value\n\n```javascript\n\nEmail.check(\"hello@example.com\")\n// true\n\nEmail.check(42)\n// false\n\n```\n\n### Optional Values\n\nUse `?` to mark optional values.\n\n```javascript\n\nconst MaybeName = Sigil`string?`\n\n```\n\nMatches:\n\n```javascript\n\nstring\nundefined\n\n```\n\n---\n\n### Arrays\n\n```javascript\n\nconst Tags = Sigil`string[]`\n\nTags.check([\"js\", \"bun\"])\n// true\n\n```\n\n---\n\n### Unions\n\n```javascript\n\nconst ID = Sigil`string | number`\n\n```\n\nMatches either type.\n\n---\n\n### Object Validation\n\n```javascript\n\nconst User = Sigil`\n{\n  name: string\n  age?: number\n}\n`\n\n```\n\nOptional properties use ` ? `.\n\n---\n\n### Nested Objects\n\n```javascript\n\nconst Order = Sigil`\n{\n  id: string\n  customer: {\n    name: string\n    email: string\n  }\n  items: {\n    name: string\n    price: number\n  }[]\n}\n`\n\n```\n\n---\n\n### Runtime Type Detection\n\nSigilJS also provides a better ` typeof `.\n\n```javascript\n\nimport { realType } from \"@antistructured/sigiljs\"\n\nrealType([])        // \"array\"\nrealType(null)      // \"null\"\nrealType(new Map()) // \"map\"\n\n```\n\n---\n\n## Why SigilJS?\n\nSigil cleanly solves four problems:\n\n1. JavaScript's native ` typeof ` is inconsistent and too weak for real type work.\n\n```javascript\n\ntypeof []\n// \"object\" 😬\n\n```\n\n2. TypeScript solves mostly compile-time problems, often adds friction, and disappears at runtime.\n\n  * TypeScript helps during development, but once your program runs the types are gone.\n\n  * SigilJS solves the runtime side of the problem.\n\n  * Describe your data once, then validate it anywhere.\n\n```typescript\n\n// TypeScript disappears at runtime\nconst x: string = 123;\n\n// No runtime error\n\n```\n\n3. Existing runtime validation libraries are dependency-heavy, allocation-happy, or ergonomically off.\n\n4. JavaScript lacks a native-feeling type expression system for runtime truth.\n\n---\n\n### Accurate Runtime Types\n\nReplacing the gaps in ` typeof ` — ` realType ` correctly identifies ` null `, ` NaN `, arrays, async and generator functions, maps, sets, and arbitrary custom classes through hooks.\n\n```javascript\n\nimport { realType } from '@antistructured/sigiljs';\n\nrealType('x');                 // \"string\"\nrealType(null);                // \"null\"\nrealType(NaN);                 // \"nan\"\nrealType([]);                  // \"array\"\nrealType(new Map());           // \"map\"\nrealType(async function() {}); // \"asyncfunction\"\n\n```\n\nYou can even provide custom override hooks to map instances directly back to nominal strings:\n\n```javascript\n\nrealType(myThing, {\n  hooks: [ v => v instanceof MyThing ? 'mything' : null ]\n}); // \"mything\"\n\n```\n\nSigilJS solves runtime type validation with a tiny, dependency-free, runtime-native type system.\n\n---\n\n## Documentation\n\nSee the [docs/](docs/README.md) folder for full, detailed documentation __(WIP)__.\n\n---\n\n## Examples\n\nSee the [examples/](examples/) folder for runnable examples __(WIP)__.\n\n---\n\n## License\n\nMIT\n\n---\n\n## CLI Playground\n\nYou can securely test out Sigil validator schemas against JSON inputs directly from your shell:\n\n```bash\n\nbun run src/playground/playground.js '{\"name\": \"D\"}' '{name: string}'\n# ✅ Validation passed\n\n```\n\n## Performance Philosophy\n\nSigilJS embraces a Functional Core / Imperative Shell architecture. It takes your schema string, turns it into a typed token stream, drops parse grouping artifacts, flattens branches, optimizes primitive unions, and finally generates a blazingly fast validator closure mapped dynamically from the ground up to minimize allocations on the hot path. Repeated tagged template passes are thoroughly memoized.\n","readmeFilename":"README.md","_rev":"1-c147c6bd01974b7328fdcff7305c7eb3"}