|
| 1 | +<h1 align="center">@compactjs/assign</h1> |
| 2 | +<h3 align="center">Recursive assign for objects and arrays</h3> |
| 3 | +<p align="center"> |
| 4 | + <a href="https://www.npmjs.com/package/@compactjs/assign" target="_blank"> |
| 5 | + <img alt="Version" src="https://img.shields.io/npm/v/@compactjs/assign.svg"> |
| 6 | + </a> |
| 7 | + <a href="https://github.com/CompactJS/assign/blob/master/LICENSE" target="_blank"> |
| 8 | + <img alt="License: MIT" src="https://img.shields.io/github/license/CompactJS/assign" /> |
| 9 | + </a> |
| 10 | +</p> |
| 11 | +<p align="center"> |
| 12 | + · |
| 13 | + <a href="https://github.com/CompactJS/assign#readme">Homepage</a> |
| 14 | + · |
| 15 | + <a href="https://github.com/CompactJS/assign/issues">Report Bug / Request Feature</a> |
| 16 | + · |
| 17 | +</p> |
| 18 | + |
| 19 | +## Table of Contents |
| 20 | + |
| 21 | +- [Installation](#Install) |
| 22 | +- [Usage](#usage) |
| 23 | +- [Test](#run-tests) |
| 24 | +- [Contact](#contact) |
| 25 | +- [Contributing](#Contributing) |
| 26 | +- [License](#license) |
| 27 | + |
| 28 | +## Install |
| 29 | + |
| 30 | +### NPM: |
| 31 | + |
| 32 | +```sh |
| 33 | +npm install @compactjs/assign |
| 34 | +``` |
| 35 | + |
| 36 | +### CDN: |
| 37 | + |
| 38 | +```html |
| 39 | +<script src="https://unpkg.com/@compactjs/assign/dist/index.umd.js"></script> |
| 40 | +``` |
| 41 | + |
| 42 | +## Usage |
| 43 | + |
| 44 | +### As module: |
| 45 | + |
| 46 | +```javascript |
| 47 | +import { assign } from '@compactjs/assign'; |
| 48 | +``` |
| 49 | + |
| 50 | +### Example: |
| 51 | + |
| 52 | +```javascript |
| 53 | +const target = { |
| 54 | + boolean: true, |
| 55 | + string: 'abc', |
| 56 | + object: { number: 0, any: 0 }, |
| 57 | +}; |
| 58 | +const source = ['34', 'abc', [14, 2]]; |
| 59 | + |
| 60 | +assign(target, source); |
| 61 | + |
| 62 | +console.log(target); |
| 63 | +// prints: |
| 64 | +// { |
| 65 | +// boolean: '34', |
| 66 | +// string: 'abc', |
| 67 | +// object: { number: 14, any: 2 }, |
| 68 | +// } |
| 69 | +``` |
| 70 | + |
| 71 | +Check out the [index.test.js](https://github.com/CompactJS/assign/blob/master/test/index.test.js) file for more examples. |
| 72 | + |
| 73 | +## Run tests |
| 74 | + |
| 75 | +```sh |
| 76 | +npm run test |
| 77 | +``` |
| 78 | + |
| 79 | +## Contact |
| 80 | + |
| 81 | +👤 **Timo Bechtel** |
| 82 | + |
| 83 | +- Website: https://timobechtel.com |
| 84 | +- Twitter: [@TimoBechtel](https://twitter.com/TimoBechtel) |
| 85 | +- GitHub: [@TimoBechtel](https://github.com/TimoBechtel) |
| 86 | + |
| 87 | +## 🤝 Contributing |
| 88 | + |
| 89 | +Contributions, issues and feature requests are welcome!<br /> |
| 90 | + |
| 91 | +1. Check [issues](https://github.com/CompactJS/assign/issues) |
| 92 | +1. Fork the Project |
| 93 | +1. Create your Feature Branch (`git checkout -b feat/AmazingFeature`) |
| 94 | +1. Test your changes `npm run test` |
| 95 | +1. Commit your Changes (`git commit -m 'feat: add amazingFeature'`) |
| 96 | +1. Push to the Branch (`git push origin feat/AmazingFeature`) |
| 97 | +1. Open a Pull Request |
| 98 | + |
| 99 | +### Commit messages |
| 100 | + |
| 101 | +This project uses semantic-release for automated release versions. So commits in this project follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0-beta.2/) guidelines. I recommend using [commitizen](https://github.com/commitizen/cz-cli) for automated commit messages. |
| 102 | + |
| 103 | +## Show your support |
| 104 | + |
| 105 | +Give a ⭐️ if this project helped you! |
| 106 | + |
| 107 | +## 📝 License |
| 108 | + |
| 109 | +Distributed under the [MIT](https://github.com/CompactJS/assign/blob/master/LICENSE) License. |
| 110 | + |
| 111 | +--- |
| 112 | + |
| 113 | +_This README was generated with ❤️ by [readme-md-generator](https://github.com/kefranabg/readme-md-generator)_ |
0 commit comments