You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.2 KiB

4 years ago
  1. # Merge Descriptors
  2. [![NPM Version][npm-image]][npm-url]
  3. [![NPM Downloads][downloads-image]][downloads-url]
  4. [![Build Status][travis-image]][travis-url]
  5. [![Test Coverage][coveralls-image]][coveralls-url]
  6. Merge objects using descriptors.
  7. ```js
  8. var thing = {
  9. get name() {
  10. return 'jon'
  11. }
  12. }
  13. var animal = {
  14. }
  15. merge(animal, thing)
  16. animal.name === 'jon'
  17. ```
  18. ## API
  19. ### merge(destination, source)
  20. Redefines `destination`'s descriptors with `source`'s.
  21. ### merge(destination, source, false)
  22. Defines `source`'s descriptors on `destination` if `destination` does not have
  23. a descriptor by the same name.
  24. ## License
  25. [MIT](LICENSE)
  26. [npm-image]: https://img.shields.io/npm/v/merge-descriptors.svg
  27. [npm-url]: https://npmjs.org/package/merge-descriptors
  28. [travis-image]: https://img.shields.io/travis/component/merge-descriptors/master.svg
  29. [travis-url]: https://travis-ci.org/component/merge-descriptors
  30. [coveralls-image]: https://img.shields.io/coveralls/component/merge-descriptors/master.svg
  31. [coveralls-url]: https://coveralls.io/r/component/merge-descriptors?branch=master
  32. [downloads-image]: https://img.shields.io/npm/dm/merge-descriptors.svg
  33. [downloads-url]: https://npmjs.org/package/merge-descriptors