Last change
on this file since e29cc2e was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.2 KB
|
Rev | Line | |
---|
[6a3a178] | 1 | # Merge Descriptors
|
---|
| 2 |
|
---|
| 3 | [![NPM Version][npm-image]][npm-url]
|
---|
| 4 | [![NPM Downloads][downloads-image]][downloads-url]
|
---|
| 5 | [![Build Status][travis-image]][travis-url]
|
---|
| 6 | [![Test Coverage][coveralls-image]][coveralls-url]
|
---|
| 7 |
|
---|
| 8 | Merge objects using descriptors.
|
---|
| 9 |
|
---|
| 10 | ```js
|
---|
| 11 | var thing = {
|
---|
| 12 | get name() {
|
---|
| 13 | return 'jon'
|
---|
| 14 | }
|
---|
| 15 | }
|
---|
| 16 |
|
---|
| 17 | var animal = {
|
---|
| 18 |
|
---|
| 19 | }
|
---|
| 20 |
|
---|
| 21 | merge(animal, thing)
|
---|
| 22 |
|
---|
| 23 | animal.name === 'jon'
|
---|
| 24 | ```
|
---|
| 25 |
|
---|
| 26 | ## API
|
---|
| 27 |
|
---|
| 28 | ### merge(destination, source)
|
---|
| 29 |
|
---|
| 30 | Redefines `destination`'s descriptors with `source`'s.
|
---|
| 31 |
|
---|
| 32 | ### merge(destination, source, false)
|
---|
| 33 |
|
---|
| 34 | Defines `source`'s descriptors on `destination` if `destination` does not have
|
---|
| 35 | a descriptor by the same name.
|
---|
| 36 |
|
---|
| 37 | ## License
|
---|
| 38 |
|
---|
| 39 | [MIT](LICENSE)
|
---|
| 40 |
|
---|
| 41 | [npm-image]: https://img.shields.io/npm/v/merge-descriptors.svg
|
---|
| 42 | [npm-url]: https://npmjs.org/package/merge-descriptors
|
---|
| 43 | [travis-image]: https://img.shields.io/travis/component/merge-descriptors/master.svg
|
---|
| 44 | [travis-url]: https://travis-ci.org/component/merge-descriptors
|
---|
| 45 | [coveralls-image]: https://img.shields.io/coveralls/component/merge-descriptors/master.svg
|
---|
| 46 | [coveralls-url]: https://coveralls.io/r/component/merge-descriptors?branch=master
|
---|
| 47 | [downloads-image]: https://img.shields.io/npm/dm/merge-descriptors.svg
|
---|
| 48 | [downloads-url]: https://npmjs.org/package/merge-descriptors
|
---|
Note:
See
TracBrowser
for help on using the repository browser.