Skip to content

CompactJS/assign

Repository files navigation

@compactjs/assign

Recursive assign for objects and arrays

Version License: MIT

· Homepage · Report Bug / Request Feature ·

Table of Contents

Install

NPM:

npm install @compactjs/assign

CDN:

<script src="https://unpkg.com/@compactjs/assign/dist/index.umd.js"></script>

Usage

As module:

import { assign } from '@compactjs/assign';

Example:

const target = {
  boolean: true,
  string: 'abc',
  object: { number: 0, any: 0 },
};
const source = ['34', 'abc', [14, 2]];

assign(target, source);

console.log(target);
// prints:
// {
//   boolean: '34',
//   string: 'abc',
//   object: { number: 14, any: 2 },
// }

Check out the index.test.js file for more examples.

Run tests

npm run test

Contact

👤 Timo Bechtel

🤝 Contributing

Contributions, issues and feature requests are welcome!

  1. Check issues
  2. Fork the Project
  3. Create your Feature Branch (git checkout -b feat/AmazingFeature)
  4. Test your changes npm run test
  5. Commit your Changes (git commit -m 'feat: add amazingFeature')
  6. Push to the Branch (git push origin feat/AmazingFeature)
  7. Open a Pull Request

Commit messages

This project uses semantic-release for automated release versions. So commits in this project follow the Conventional Commits guidelines. I recommend using commitizen for automated commit messages.

Show your support

Give a ⭐️ if this project helped you!

📝 License

Distributed under the MIT License.


This README was generated with ❤️ by readme-md-generator