![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
A pure-javascript adaptation of the W3C's structured cloning algorithm, designed to provide an easy interface for deep copying of complex objects
Cyclone is an attempt to implement an adaptation of the HTML5 Structured Cloning Algorithm.
It is meant to be:
postMessage()
,
replaceState()
, etc), and therefore agnostic to types such as File
,
Blob
, etc (which also allows it to be synchronous in the first place).cloneNode
It can handle objects containing:
null
undefined
function Foo() { this.bar = 'baz' }; var cloneable = new Foo();
)This module exposes a single object, CY
, into the global scope when used within browsers. A client can then use
this module's clone
method to perform clone operations.
var o = {
date: new Date(),
number: Math.random()
};
o.self = o;
o.tricky = { self: o };
var c = CY.clone(o);
c === o; // false
c.date === o.date; // false
+(c.date) === +(o.date); // true
c.number === o.number; // true
c.self === c; // true
c.tricky.self === c; // true
Note that cycloneJS also supports AMD loading as well as use within nodeJS, so with node you could do something like
var CY = require('cyclonejs');
// Do some CY.clone()-ing
First install the module
$ git clone https://github.com/traviskaufman/cycloneJS.git
$ cd /path/to/cycloneJS
$ npm install .
Then just run npm test
within the module's directory whenever you want to test. This will run jshint on all javascript
files as well as run tests against cyclone.
FAQs
A pure-javascript adaptation of the W3C's structured cloning algorithm, designed to provide an easy interface for deep copying of complex objects
We found that cyclonejs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.