Nearsighted Penguin March

    just-clone
    TypeScript icon, indicating that this package has built-in type declarations

    6.0.1 • Public • Published

    just-clone

    Part of a library of zero-dependency npm modules that do just do one thing. Guilt-free utilities for every occasion.

    🍦 Try it

    npm install just-clone
    yarn add just-clone

    Deep copies objects, arrays, maps and sets

    // Deep copies objects and arrays, doesn't clone functions
    
    import clone from 'just-clone';
    
    var arr = [1, 2, 3];
    var subObj = { aa: 1 };
    var obj = { a: 3, b: 5, c: arr, d: subObj };
    var objClone = clone(obj);
    arr.push(4);
    objClone.d.bb = 2;
    obj; // {a: 3, b: 5, c: [1, 2, 3, 4], d: {aa: 1}}
    objClone; // {a: 3, b: 5, c: [1, 2, 3], d: {aa: 1, bb: 2}}

    Install

    npm i just-clone

    DownloadsWeekly Downloads

    25,335

    Version

    6.0.1

    License

    MIT

    Unpacked Size

    8.23 kB

    Total Files

    10

    Last publish

    Collaborators

    • angus-c