sistema creado v0.5.0
Some checks failed
build-and-push / deploy (push) Has been skipped
build-and-push / build (push) Failing after 6s

This commit is contained in:
2025-05-14 16:10:41 -06:00
parent b5e40cf4ac
commit 745168cf51
193 changed files with 7267 additions and 8789 deletions

View File

@@ -1,55 +1,49 @@
# merge-descriptors
> Merge objects using their property descriptors
[![NPM Version][npm-image]][npm-url]
[![NPM Downloads][downloads-image]][downloads-url]
[![Build Status][travis-image]][travis-url]
[![Test Coverage][coveralls-image]][coveralls-url]
## Install
```sh
npm install merge-descriptors
```
## Usage
Merge objects using descriptors.
```js
import mergeDescriptors from 'merge-descriptors';
const thing = {
get name() {
return 'John'
}
var thing = {
get name() {
return 'jon'
}
}
const animal = {};
var animal = {
mergeDescriptors(animal, thing);
}
console.log(animal.name);
//=> 'John'
merge(animal, thing)
animal.name === 'jon'
```
## API
### merge(destination, source, overwrite?)
### merge(destination, source)
Merges "own" properties from a source to a destination object, including non-enumerable and accessor-defined properties. It retains original values and descriptors, ensuring the destination receives a complete and accurate copy of the source's properties.
Redefines `destination`'s descriptors with `source`'s. The return value is the
`destination` object.
Returns the modified destination object.
### merge(destination, source, false)
#### destination
Defines `source`'s descriptors on `destination` if `destination` does not have
a descriptor by the same name. The return value is the `destination` object.
Type: `object`
## License
The object to receive properties.
[MIT](LICENSE)
#### source
Type: `object`
The object providing properties.
#### overwrite
Type: `boolean`\
Default: `true`
A boolean to control overwriting of existing properties.
[npm-image]: https://img.shields.io/npm/v/merge-descriptors.svg
[npm-url]: https://npmjs.org/package/merge-descriptors
[travis-image]: https://img.shields.io/travis/component/merge-descriptors/master.svg
[travis-url]: https://travis-ci.org/component/merge-descriptors
[coveralls-image]: https://img.shields.io/coveralls/component/merge-descriptors/master.svg
[coveralls-url]: https://coveralls.io/r/component/merge-descriptors?branch=master
[downloads-image]: https://img.shields.io/npm/dm/merge-descriptors.svg
[downloads-url]: https://npmjs.org/package/merge-descriptors