Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/johanholmerin/structured-clone

Structured clone algorithm in Javascript
https://github.com/johanholmerin/structured-clone

Last synced: about 1 month ago
JSON representation

Structured clone algorithm in Javascript

Awesome Lists containing this project

README

        

# Structured clone

A Javascript implementation of the structured clone algorithm.

No external dependencies.

## Install

```sh
# Yarn
yarn add @johanholmerin/structured-clone

# npm
npm install @johanholmerin/structured-clone
```

## Usage

```javascript
import structuredClone from '@johanholmerin/structured-clone';

const newObj = structuredClone(obj);
```

## Limitations

- `CryptoKey` and `ImageBitmap` are not supported, since there is no way to
synchronously make a copy.
- Copying `FileList` is only supported in browsers that support the
`DataTransfer` constructor.
- Does not support the [transfer](https://html.spec.whatwg.org/multipage/structured-data.html#structured-cloning) parameter