1.0.0 • Published 4 years ago
js-deep-cloning v1.0.0
Javascript Deep Cloning
Javascript deep cloning, so pointers are lost.
Usage
Install the package
package.json
{
  "dependencies": {
    "js-deep-cloning": "latest"
  }
}After that (with Yarn):
yarn installOr with NPM:
npm installAnd finally you can use it in your project:
import { deepClone } from "js-deep-cloning"
const student = {
  id: 1,
  name: "Jack",
  items: ["pen", "rubber", "textbook", "tablet"],
  examDate: new Date(),
  classmates: [
    {
      id: 2,
      name: "John",
      items: null,
      examDate: new Date()
    },
    {
      id: 2,
      name: "James",
      items: ["pencil", "laptop"],
      exams: [new Date(), new Date()]
    }
  ],
  university: null
}
const studentData = deepClone(student)Contribution
Everybody can contribute
Useful commands (examples with yarn)
Build your code:
yarn buildRun tests:
yarn testGenerate test coverage:
yarn test:coverageRun ESLint:
yarn lintImportant
Please before opening a PR for this package - run tests and eslint and fix the errors in your code.
License
MIT
1.0.0
4 years ago