{"id":16170716,"url":"https://github.com/holtwick/zeed","last_synced_at":"2025-10-28T11:42:49.567Z","repository":{"id":48024989,"uuid":"381935054","full_name":"holtwick/zeed","owner":"holtwick","description":"🌱 Simple foundation library / framework written in Typescript. No dependencies. Tree shakable.","archived":false,"fork":false,"pushed_at":"2025-03-31T14:29:14.000Z","size":2069,"stargazers_count":36,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-10T01:08:22.578Z","etag":null,"topics":["array-manipulations","event-emitter","javascript","logging","queues","serial-queues","sortable","typescript","uid","zeed","zerva"],"latest_commit_sha":null,"homepage":"https://zeed.holtwick.de","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/holtwick.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["holtwick"]}},"created_at":"2021-07-01T06:40:11.000Z","updated_at":"2025-03-31T14:29:19.000Z","dependencies_parsed_at":"2023-10-11T17:48:56.640Z","dependency_job_id":"b7e35f96-2068-4e7a-83bb-4e1ea4f488af","html_url":"https://github.com/holtwick/zeed","commit_stats":{"total_commits":910,"total_committers":2,"mean_commits":455.0,"dds":0.007692307692307665,"last_synced_commit":"0aad04ca9938397b85c9a663cee0ffc9460453a0"},"previous_names":[],"tags_count":1051,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holtwick%2Fzeed","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holtwick%2Fzeed/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holtwick%2Fzeed/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holtwick%2Fzeed/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/holtwick","download_url":"https://codeload.github.com/holtwick/zeed/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248137887,"owners_count":21053775,"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","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":["array-manipulations","event-emitter","javascript","logging","queues","serial-queues","sortable","typescript","uid","zeed","zerva"],"created_at":"2024-10-10T03:19:25.733Z","updated_at":"2025-10-28T11:42:49.536Z","avatar_url":"https://github.com/holtwick.png","language":"TypeScript","funding_links":["https://github.com/sponsors/holtwick"],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n# 🌱 Zeed\n\n**A zero-dependency TypeScript utility library for universal JavaScript**\n\n[![npm version](https://img.shields.io/npm/v/zeed.svg)](https://www.npmjs.com/package/zeed)\n[![License](https://img.shields.io/npm/l/zeed.svg)](https://github.com/holtwick/zeed/blob/main/LICENSE)\n[![TypeScript](https://img.shields.io/badge/TypeScript-Ready-blue.svg)](https://www.typescriptlang.org/)\n\n[Documentation](https://zeed.holtwick.de/) • [GitHub](https://github.com/holtwick/zeed) • [Codeberg](https://codeberg.org/holtwick/zeed)\n\n\u003c/div\u003e\n\n---\n\n\u003e [!CAUTION]\n\u003e The main repository is now at \u003chttps://codeberg.org/holtwick/zeed\u003e to strengthen European sovereignty. Learn more at [UnplugTrump](https://holtwick.de/blog/unplug-trump).\n\n## ✨ Features\n\n\u003ctable\u003e\n\u003ctr\u003e\n\u003ctd width=\"50%\"\u003e\n\n### 🎯 **Type-Safe**\nStrict TypeScript with full type inference\n\n### 📦 **Zero Dependencies**\nLightweight and completely tree-shakable\n\n### 🌍 **Universal**\nWorks in browsers, Node.js, Deno, and Bun\n\n\u003c/td\u003e\n\u003ctd width=\"50%\"\u003e\n\n### ⚡ **Modern ESM**\nES Modules with CommonJS fallback\n\n### ✅ **Well Tested**\nComprehensive test coverage\n\n### 🔌 **Standard Schema**\nCompatible with tRPC, TanStack, Hono \u0026 more\n\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\n## 🚀 Quick Start\n\n```sh\nnpm install zeed\n# or\npnpm add zeed\n# or\nyarn add zeed\n```\n\n---\n\n## 📚 Core Features\n\n### 🪵 Universal Logging\n\nPowerful, filterable logging for browser and terminal with colorful output and stack traces.\n\n```ts\nimport { Logger } from 'zeed'\n\nconst log = Logger('demo')\n\nlog('Hello World')\nlog.info('Info')\nlog.warn('Warning')\nlog.error('Error')\n```\n\n**Terminal output:**\n\n\u003cimg src=\".assets/node-console@2x.png\" width=\"566\" style=\"max-width:100%\"\u003e\n\n**Browser output:**\n\n\u003cimg src=\".assets/safari-console.png\" style=\"max-width:100%\"\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e📖 Learn more about logging features\u003c/summary\u003e\n\n**Filtering:**\n\nBy default, logs are muted. Enable them with filters:\n\n**Browser:**\n```ts\nlocalStorage.zeed = '*'\n```\n\n**Node.js:**\n```sh\nZEED=* node myapp.js\n```\n\nYou can use advanced filters compatible with [debug syntax](https://github.com/visionmedia/debug#wildcards). Use `ZEED` or `DEBUG` environment variables (`ZEED` supersedes `DEBUG`).\n\nFilter by level: `ZEED_LEVEL=info` to hide debug logs.\n\nWrite to file: `ZEED_LOG=/path/to/file.log`\n\n**Log Handlers:**\n\n- `LoggerConsoleHandler(opt)` - Plain console output\n- `LoggerBrowserHandler(opt)` - Colorful browser logs\n- `LoggerNodeHandler(opt)` - Colorful Node.js logs\n- `LoggerFileHandler(path, opt)` - File output with optional rotation\n\n**Log Rotation Example:**\n```ts\nimport { LoggerFileHandler } from 'zeed'\n\nLoggerFileHandler('/var/log/app.log', {\n  rotation: {\n    size: '10M',\n    maxFiles: 5,\n    compress: 'gzip'\n  }\n})\n```\n\n\u003c/details\u003e\n\n---\n\n### ⚙️ Async/Promise Utilities\n\nPowerful utilities for working with async operations:\n\n```ts\n// Wait for an event\nawait waitOn(emitter, 'action', 1000)\n\n// Sleep for milliseconds\nawait sleep(1000)\n\n// Timeout a promise\nawait timeout(asyncFn, 1000)\n\n// Ensure a value is a Promise\nawait promisify(returnValue)\n```\n\n---\n\n### 🆔 Unique ID Generation\n\nMultiple ID generation strategies for different use cases:\n\n```ts\n// UUID (Base62, 22 chars) - cryptographically secure\nconst id = uuid()\n\n// Sortable UID with timestamp\nconst sortable = suid()\nsuidDate(sortable) // Extract timestamp\n\n// Named incremental IDs (great for debugging)\nuname('user') // =\u003e 'user-0'\nuname('user') // =\u003e 'user-1'\n\n// Classic UUID v4\nconst classic = uuidv4() // =\u003e 'a7755f8d-ef6f-45e9-8db3-d29347a4a2a1'\n```\n\n**Available ID types:** `uuid`, `uuidB32`, `suid`, `quid`, `uuidv4`\n\n---\n\n### 🎯 Typed Event Emitter\n\nType-safe, async event emitter with full TypeScript support:\n\n```ts\ninterface MyEvents {\n  inc: (count: number) =\u003e number\n}\n\nconst e = new Emitter\u003cMyEvents\u003e()\ne.on('inc', async count =\u003e counter + 1)\nawait e.emit('inc', 1)\n\n// Or use the .call proxy\nawait e.call.inc(1)\n```\n\n**Global emitter** for cross-module communication:\n\n```ts\ndeclare global {\n  interface ZeedGlobalEmitter {\n    test: (x: string) =\u003e void\n  }\n}\n\ngetGlobalEmitter().call.test('Hello World')\n```\n\n---\n\n### 💬 Messaging\n\nType-safe messaging infrastructure for client-server communication:\n\n```ts\nconst m = useMessageHub({ channel }).send\u003cMyMessages\u003e()\nm.echo({ hello: 'world' })\n```\n\n\u003e 📖 [Full messaging documentation](./src/common/msg/README.md)\n\n---\n\n### ✅ Schema Validation\n\n\u003cdiv align=\"center\"\u003e\n\n**🎯 Type-safe • 🔄 Standard Schema Compatible • 🚀 Zero Dependencies**\n\n\u003c/div\u003e\n\nPowerful schema validation with full TypeScript inference and [Standard Schema](https://github.com/standard-schema/standard-schema) support:\n\n```ts\nimport { z } from 'zeed'\n\n// Define and validate schemas\nconst userSchema = z.object({\n  name: z.string(),\n  email: z.string(),\n  age: z.number().optional(),\n  role: z.stringLiterals(['admin', 'user', 'guest']),\n})\n\n// Full type inference\ntype User = z.infer\u003ctypeof userSchema\u003e\n\n// Parse and validate\nconst user = schemaParseObject(userSchema, data)\n```\n\n\u003cdetails\u003e\n\u003csummary\u003e🔗 Standard Schema Compatibility\u003c/summary\u003e\n\nCompatible with **tRPC**, **TanStack Form/Router**, **Hono**, and [40+ other libraries](https://github.com/standard-schema/standard-schema#what-tools--frameworks-accept-spec-compliant-schemas):\n\n```ts\n// Use with any standard-schema-compatible library\nconst schema = z.object({\n  name: z.string(),\n  count: z.number(),\n})\n\nconst result = schema['~standard'].validate({ name: 'test', count: 42 })\nif (result.issues) {\n  console.error('Validation failed:', result.issues)\n}\nelse {\n  console.log('Valid data:', result.value)\n}\n```\n\n**Features:**\n- Primitives: `string()`, `number()`, `int()`, `boolean()`, `any()`\n- Objects: `object()`, `record()`, `pick()`, `omit()`, `extend()`, `partial()`, `required()`\n- Arrays \u0026 Tuples: `array()`, `tuple()`\n- Unions \u0026 Literals: `union()`, `literal()`, `stringLiterals()`\n- Modifiers: `.optional()`, `.default()`, `.describe()`\n\n\u003c/details\u003e\n\n\u003e 📖 [Complete schema documentation](./src/common/schema/README.md)\n\n---\n\n### 📊 Additional Utilities\n\n\u003ctable\u003e\n\u003ctr\u003e\n\u003ctd width=\"50%\"\u003e\n\n**🔄 CRDT Sorting**\n```ts\ninterface Row extends SortedItem {\n  id: string\n  title: string\n}\nsortedItems(rows)\n```\n\n**🔐 Binary Encoding**\n```ts\nconst { encode, decode } = useBase(62)\ndecode(encode(data)) === data\n```\n\n\u003c/td\u003e\n\u003ctd width=\"50%\"\u003e\n\n**🔍 Deep Object Utils**\n```ts\ndeepEqual(obj1, obj2)\ndeepMerge(obj1, obj2)\n```\n\n**🧹 Resource Disposal**\n```ts\nconst dispose = useDispose()\ndispose.add(cleanup)\nawait dispose()\n```\n\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\n---\n\n## 📦 More Features\n\nZeed includes many more utilities - explore the [full API documentation](https://zeed.holtwick.de/)!\n\n## 🤝 Related Projects\n\n**By the same author:**\n- [zeed-dom](https://github.com/holtwick/zeed-dom) - DOM manipulation utilities\n- [zerva](https://github.com/holtwick/zerva) - Modular server framework\n\n**Similar utility libraries:**\n- [lib0](https://github.com/dmonad/lib0) - Fundamental utility functions\n- [antfu/utils](https://github.com/antfu/utils) - Collection of common utilities\n- [vueuse](https://vueuse.org/) - Vue composition utilities\n- [unjs](https://github.com/unjs/) - Unified JavaScript tools\n\n## 📄 License\n\nMIT\n\n---\n\n\u003cdiv align=\"center\"\u003e\n\n**Built with ❤️ by [Dirk Holtwick](https://holtwick.de)**\n\n[⭐ Star on GitHub](https://github.com/holtwick/zeed) • [📖 Documentation](https://zeed.holtwick.de/) • [🐛 Report Issue](https://github.com/holtwick/zeed/issues)\n\n\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fholtwick%2Fzeed","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fholtwick%2Fzeed","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fholtwick%2Fzeed/lists"}