Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/philecker/copy-json
📦 An NPM package of a utility function to easily create a deep copy of a JSON object.
https://github.com/philecker/copy-json
javascript json npm npm-package utility
Last synced: about 1 month ago
JSON representation
📦 An NPM package of a utility function to easily create a deep copy of a JSON object.
- Host: GitHub
- URL: https://github.com/philecker/copy-json
- Owner: philecker
- License: mit
- Created: 2023-05-30T17:30:23.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-06-03T01:48:05.000Z (over 1 year ago)
- Last Synced: 2024-12-23T11:50:06.000Z (about 1 month ago)
- Topics: javascript, json, npm, npm-package, utility
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/copy-json
- Size: 4.88 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# copy-json
A utility function to create a deep copy of a JSON object.
## Installation
You can install the package using npm:
```shell
npm install copy-json
```## Usage
In your JavaScript file, import the `copyJSON` function and use it to create a deep copy of a JSON object:
```javascript
import copyJSON from 'copy-json';const originalObj = { name: 'John', age: 25 };
const copiedObj = copyJSON(originalObj);console.log(originalObj); // { name: 'John', age: 25 }
console.log(copiedObj); // { name: 'John', age: 25 }
console.log(originalObj === copiedObj); // false (they are separate objects)
```## API
### `copyJSON(jsonObj)`
Creates a deep copy of a JSON object.
- `jsonObj`: The JSON object to be copied.
Returns a deep copy of the input JSON object.
## License
This package is licensed under the MIT License. See the [LICENSE](LICENSE) file for more information.
---
Feel free to customize the README file based on your specific needs and additional information about the package. Include any relevant details about the function, usage examples, configuration options, or any other information that might be helpful for users of your package.