6 snippets · production-ready JavaScript & TypeScript
A TypeScript function that recursively merges two objects with full type safety. Arrays are concatenated, primitives are overwritten by the source, and nested objects are merged recursively.
A production-ready deep clone utility that leverages the native structuredClone API when available, with a comprehensive manual fallback that correctly handles special object types and circular references.
A factory function that wraps objects in a Proxy, validating all property assignments against a Zod schema at runtime while maintaining transparent read access.
A production-ready TypeScript implementation of an observable object pattern using Proxy, featuring deep reactivity for nested objects, batch update capabilities to minimize notifications, and fully typed subscription callbacks.
Production-ready pick and omit utility functions that leverage TypeScript's type system to create perfectly typed object subsets with full inference support.
A recursive TypeScript function that transforms nested objects into flat objects with dot-notation keys, supporting custom separators and proper type safety.