klona
Tiny, fast deep-clone library for JavaScript with multiple flavors for different use cases. klona/full handles all JS types including Date, RegExp, Array, Map, Set, and typed arrays. klona/lite is the tiniest version for plain objects. klona/json uses JSON.parse/stringify for JSON-safe cloning. The 'lite' flavor is ~200 bytes. A modern, focused alternative to lodash.cloneDeep.
Score Breakdown
⚙ Agent Friendliness
🔒 Security
MIT licensed. Zero dependencies. Local computation — no security concerns.
⚡ Reliability
Best When
You're building a browser-side application and need a tiny, fast deep clone utility with minimal bundle impact.
Avoid When
You're in Node.js 17+ where structuredClone() is built-in, or you need circular reference support.
Use Cases
- • Deep clone JavaScript plain objects and arrays in agent state management pipelines
- • Create isolated copies of agent configuration objects before modification
- • Clone test data fixtures with full type fidelity including Date, Set, and Map support
- • Implement copy-on-write patterns in agent data pipelines with minimal bundle overhead
- • Replace lodash.cloneDeep in bundle-size-sensitive browser agent applications
Not For
- • Server-side Node.js where structuredClone() is available — built-in structuredClone is comprehensive and dependency-free
- • Cloning class instances — klona strips prototype methods; use a class-aware clone for domain objects
- • Circular references — klona does not handle circular references; use rfdc with circles:true option
Interface
Authentication
Local library — no authentication required. MIT licensed.
Pricing
MIT licensed. Zero cost. Very small package — ~200 bytes for lite flavor.
Agent Metadata
Known Gotchas
- ⚠ Choose the right flavor: klona/lite for plain objects (smallest), klona/full for all JS types (Date, Set, Map), klona/json for JSON-safe data
- ⚠ Circular references are NOT supported — will cause infinite recursion; use rfdc({ circles: true }) or structuredClone for circular data
- ⚠ Prototype chain stripped — class instances lose methods after cloning; only own enumerable properties are cloned
- ⚠ In Node.js 17+, prefer built-in structuredClone(obj) — handles more types including ArrayBuffer, Error, and handles circular references
- ⚠ klona/full adds ~400 bytes over klona/lite — only use full when you actually have Date, Set, or Map in your data
- ⚠ ESM-only package — CommonJS require() won't work; ensure your bundler handles ESM
Alternatives
Full Evaluation Report
Detailed scoring breakdown, competitive positioning, security analysis, and improvement recommendations for klona.
Scores are editorial opinions as of 2026-03-06.