Neverending Prototype Mode

    deep-clone-util

    6.0.0 • Public • Published

    deep-clone-util

    Utility to deep clone javascript objects

    npm version Node.js CI

    ## Clone - JS utility to deep clone an object With deep cloning becoming a regular practice & a required thing for supporting immutability, deep-clone-util provides a way just to do that.

    • No dependeny on any library
    • 2kB of unzipped bundle size

    ### Supports cloning of:

    • Elementary values
    • Array, Objects (nesting upto any level)
    • Functions
    • Promises
    • Dates
    • Regular expressions
    • Maps & Sets

    ### Todo

    • Support circular references
    • Suppprt more object types

    ### Installation npm i deep-clone-util

    Examples

    const clone = require('deep-clone-util');
    const obj = {
     a: 1,
     b: "string",
     c: function(a) {console.log(a)},
     d: [1,2,3],
     f: {
      g: 1
     }
    }
    
    const clonedObj = clone(obj)
    obj.f.g = 10
    console.log(obj.f.g) // Prints 1
    

    Contributions

    • Author: Gaurav Behere
    • Please raise a PR, if you see some improvement possible.

    Install

    npm i deep-clone-util

    DownloadsWeekly Downloads

    2

    Version

    6.0.0

    License

    ISC

    Unpacked Size

    15.7 kB

    Total Files

    4

    Last publish

    Collaborators

    • gbehere