@f/clone-shallow

    1.1.4 • Public • Published

    clone-shallow

    Build status Git tag NPM version Code style

    Create a shallow clone of an object or array

    Installation

    $ npm install @f/clone-shallow
    

    Usage

    var clone = require('@f/clone-shallow')
     
    var arr = [1, 2, 3, 4]
    var newArr = clone(arr)
     
    deepEqual(arr, newArr)
    arr !== newArr
     
    var obj = {a: 1, b: 2, c: 3}
    var newObj = clone(obj)
     
    deepEqual(obj, newObj)
    obj !== newObj

    API

    cloneShallow(a)

    • a - The object or array to be cloned

    Returns: A new object or array with identical contents to a.

    License

    MIT

    Keywords

    none

    Install

    npm i @f/clone-shallow

    DownloadsWeekly Downloads

    37

    Version

    1.1.4

    License

    MIT

    Last publish

    Collaborators

    • f