Socket
Socket
Sign inDemoInstall

fclone

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fclone

Clone objects by dropping circular references


Version published
Weekly downloads
1.6M
decreased by-0.01%
Maintainers
1
Weekly downloads
 
Created

What is fclone?

The fclone npm package is designed to provide deep cloning functionality for JavaScript objects. It ensures that complex objects, including those with circular references, are cloned accurately without losing any data or structure.

What are fclone's main functionalities?

Deep Cloning

This feature allows you to create a deep clone of an object, ensuring that nested objects are also cloned rather than referenced.

const fclone = require('fclone');
const original = { a: 1, b: { c: 2 } };
const clone = fclone(original);
console.log(clone); // { a: 1, b: { c: 2 } }

Handling Circular References

fclone can handle objects with circular references, ensuring that the clone maintains the same structure without causing infinite loops.

const fclone = require('fclone');
const obj = { a: 1 };
obj.self = obj;
const clone = fclone(obj);
console.log(clone); // { a: 1, self: [Circular] }

Cloning Arrays

This feature allows you to deep clone arrays, ensuring that nested objects within the array are also cloned.

const fclone = require('fclone');
const original = [1, 2, { a: 3 }];
const clone = fclone(original);
console.log(clone); // [1, 2, { a: 3 }]

Other packages similar to fclone

Keywords

FAQs

Package last updated on 23 Jan 2017

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc