Skip to content

About

High-performance deep clone utility with descriptor support. Handles circular ref and complex built-in types.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Bunshin Clone

High-performance deep clone utility with descriptor support. Handles circular ref and complex built-in types.

Install

npm i bunshin-clone
// npm
import { bunshinClone } from 'bunshin-clone';

// CDNs
import { bunshinClone } from 'https://esm.sh/bunshin-clone@<x.x.x>';
// or
import { bunshinClone } from 'https://cdn.jsdelivr.net/npm/bunshin-clone@<x.x.x>/+esm';
// or
import { bunshinClone } from 'https://esm.unpkg.com/bunshin-clone@<x.x.x>';

📦 APIs

bunshinClone<T>(value, options);
// => T
//
// value: T
// options (optional): BunshinCloneOptions

🪄 Options

interface BunshinCloneOptions {
  preserveBufferSharing: boolean; // default: false
  preserveDescriptors: boolean;   // default: false
  preserveSymbolKeys: boolean;    // default: false
}

preserveBufferSharing

If true, preserves shared backing buffers between TypedArray and DataView instances.

preserveDescriptors

If true, preserves property descriptors, including non-enumerable properties.

preserveSymbolKeys

If true, preserves symbol keys (slower).

About

High-performance deep clone utility with descriptor support. Handles circular ref and complex built-in types.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages