# clone-json

> deep copy json

Latest version **1.0.2** (published 2018-05-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install clone-json
pnpm add clone-json
yarn add clone-json
bun add clone-json
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2018-05-17 |
| First published | 2018-02-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Black-Hole |
| Maintainers | black_hole |
| Keywords | json, copy-json, clone-json, deep-copy-json |

## Links

- npm: https://www.npmjs.com/package/clone-json
- Repository: https://github.com/BlackHole1/clone-json
- Homepage: https://github.com/BlackHole1/clone-json#readme
- Issues: https://github.com/BlackHole1/clone-json/issues
- npm.io page: https://npm.io/package/clone-json

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.0.2 (latest) — 2018-05-17
- 1.0.1 — 2018-02-24
- 1.0.0 — 2018-02-24

## README

# clone-json
[![Node Version](https://img.shields.io/badge/node.js-%3E=_6-green.svg)](https://travis-ci.org/BlackHole1/clone-json)
[![Build Status](https://travis-ci.org/BlackHole1/clone-json.svg?branch=master)](https://travis-ci.org/BlackHole1/clone-json)
[![Coverage Status](https://coveralls.io/repos/github/BlackHole1/clone-json/badge.svg?branch=master)](https://coveralls.io/github/BlackHole1/clone-json?branch=master)
[![Npm Downlaod](https://img.shields.io/npm/dy/clone-json.svg)](https://www.npmjs.com/package/clone-json)

[![NPM](https://nodei.co/npm/clone-json.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/clone-json/)

## install

``` bash
# Install with npm
$ npm install clone-json --save

# Install with yarn
$ yarn add clone-json
```

## Usage

Two arrays are equal
```javascript
let cloneJson = require('clone-json')

let json = {
  a: 123,
  b: 'str',
  c: true,
  d: [1, '2', false, {
    e: 3
  }],
  f: {
    g: 789,
    h: 'str',
    i: true,
    j: [2]
  }
}

let newJson = cloneJson(json)

newJson.a = 456
newJson.b = 'string',
newJson.c = false,
newJson.d[0] = 2
newJson.d[1] = '3'
newJson.d[2] = true
newJson.d[3].e = 4
newJson.f.g = 987
newJson.f.h = 'string'
newJson.f.i = false,
newJson.f.j[0] = 3

console.log(json) // => No changes have taken place
/* result: 
{
  a: 123,
  b: 'str',
  c: true,
  d: [1, '2', false, {
    e: 3
  }],
  f: {
    g: 789,
    h: 'str',
    i: true,
    j: [2]
  }
}
*/

console.log(newJson)
/* result:
{
  a: 456,
  b: 'string',
  c: false,
  d: [2, '3', true, {
    e: 4
  }],
  f: {
    g: 987,
    h: 'string',
    i: false,
    j: [3]
  }
}
```

## Contributing

| **Commits** | **Contributor** | 
| --- | --- |
| 5 | [Black-Hole](https://github.com/BlackHole1) |

## Author

**Black-Hole**

* Email：158blackhole@gmail.com
* Blog：[http://bugs.cc](http://bugs.cc)
* WeiBo：[http://weibo.com/comelove](http://weibo.com/comelove)
* Twitter：[https://twitter.com/Free_BlackHole](https://twitter.com/Free_BlackHole)

---
_Source: https://npm.io/package/clone-json · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
