iching-broker-level2/node_modules/merge-descriptors
Christopher Hase 9aeeb95994
Some checks are pending
ci / build (push) Waiting to run
add http-server part 5.9
2025-04-09 16:12:34 +02:00
..
index.d.ts add http-server part 5.9 2025-04-09 16:12:34 +02:00
index.js add http-server part 5.9 2025-04-09 16:12:34 +02:00
license add http-server part 5.9 2025-04-09 16:12:34 +02:00
package.json add http-server part 5.9 2025-04-09 16:12:34 +02:00
readme.md add http-server part 5.9 2025-04-09 16:12:34 +02:00

merge-descriptors

Merge objects using their property descriptors

Install

npm install merge-descriptors

Usage

import mergeDescriptors from 'merge-descriptors';

const thing = {
	get name() {
		return 'John'
	}
}

const animal = {};

mergeDescriptors(animal, thing);

console.log(animal.name);
//=> 'John'

API

merge(destination, source, overwrite?)

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.

Returns the modified destination object.

destination

Type: object

The object to receive properties.

source

Type: object

The object providing properties.

overwrite

Type: boolean
Default: true

A boolean to control overwriting of existing properties.