0.0.2 • Published 8 months ago

xy-deep-clone v0.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
8 months ago

xyDeepClone is a utility function that allows you to create deep clones of JavaScript objects. It ensures that all properties and nested objects are copied into a completely independent new object. This is useful when you need to duplicate an object without sharing references to the original data.

Installation

To use xyDeepClone, you'll need to include the provided TypeScript file in your project.

  1. Download the xyDeepClone.ts file from this repository.
  2. Add the file to your project directory.

Usage

  1. Import the xyDeepClone class into your TypeScript code:

    import { xyDeepClone } from 'xy-deep-clone'
    
    const originalObject = {
       name: 'John',
       age: 30,
       address: {
          street: '123 Main St',
          city: 'Anytown',
       },
       hobbies: ['Reading', 'Gardening'],
    };
    const clonedObject = xyDeepClone(originalObject)
  2. Import the xyDeepClone class into your Javascript code:

    const { xyDeepClone } = require("xy-deep-clone")
    
       const originalObject = {
       name: 'John',
       age: 30,
       address: {
          street: '123 Main St',
          city: 'Anytown',
       },
       hobbies: ['Reading', 'Gardening'],
    };
    const clonedObject = xyDeepClone(originalObject)

Support Me

If you find this project helpful or want to show your appreciation, you can support me by buying me a coffee. Your support is greatly appreciated!