|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
1.3 KB
|
| Line | |
|---|
| 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. The return value is the
|
|---|
| 31 | `destination` object.
|
|---|
| 32 |
|
|---|
| 33 | ### merge(destination, source, false)
|
|---|
| 34 |
|
|---|
| 35 | Defines `source`'s descriptors on `destination` if `destination` does not have
|
|---|
| 36 | a descriptor by the same name. The return value is the `destination` object.
|
|---|
| 37 |
|
|---|
| 38 | ## License
|
|---|
| 39 |
|
|---|
| 40 | [MIT](LICENSE)
|
|---|
| 41 |
|
|---|
| 42 | [npm-image]: https://img.shields.io/npm/v/merge-descriptors.svg
|
|---|
| 43 | [npm-url]: https://npmjs.org/package/merge-descriptors
|
|---|
| 44 | [travis-image]: https://img.shields.io/travis/component/merge-descriptors/master.svg
|
|---|
| 45 | [travis-url]: https://travis-ci.org/component/merge-descriptors
|
|---|
| 46 | [coveralls-image]: https://img.shields.io/coveralls/component/merge-descriptors/master.svg
|
|---|
| 47 | [coveralls-url]: https://coveralls.io/r/component/merge-descriptors?branch=master
|
|---|
| 48 | [downloads-image]: https://img.shields.io/npm/dm/merge-descriptors.svg
|
|---|
| 49 | [downloads-url]: https://npmjs.org/package/merge-descriptors
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.