# object-extend

> A well-tested function to deep extend (or merge) JavaScript objects

Latest version **0.5.0** (published 2013-04-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install object-extend
pnpm add object-extend
yarn add object-extend
bun add object-extend
```

## Health

**Score 5/100 (F)** — status: abandoned.

Warnings: low downloads; no types; no esm support; has vulnerabilities; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.5.0 |
| Published | 2013-04-10 |
| First published | 2013-04-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 0.4.x |
| Dependencies | 0 |
| Known vulnerabilities | 1 |
| Install scripts | no |
| Author | Bernhard Wanger |
| Maintainers | bernhardw |
| Keywords | extend, merge, extend objects, merge objects |

## Links

- npm: https://www.npmjs.com/package/object-extend
- Repository: https://github.com/bernhardw/object-extend
- npm.io page: https://npm.io/package/object-extend

## Recent versions

- 0.5.0 (latest) — 2013-04-10

## README

object-extend
=============

A well-tested function to deep extend (or merge) JavaScript objects without further dependencies.

Unit-tested with over 94 single assertion tests.


Usage
-----
```javascript
var a = {
    app: 'My App',
    environment: 'development',
    connections: {
        default: 'mysql',
        mysql: {
            driver: 'mysql',
            host: 'localhost',
            database: 'myapp.dev'
        }
    }
};

var b = {
    environment: 'production',
    connections: {
        mysql: {
            database: 'myapp.prod'
        }
    }
};

extend(a, b);

// Result:
{
    app: 'My App',
    environment: 'production',
    connections: {
        default: 'mysql',
        mysql: {
            driver: 'mysql',
            host: 'localhost',
            database: 'myapp.prod'
        }
    }
}
```


Limitations
-----------

Array:
Only actual objects are extended. Arrays will not be merged but overwritten.
```javascript
var a { foo: [1, 2, 3] };
var b { foo: [4, 5, 6] };

extend(a, b); // { foo: [4, 5, 6] }
```


Notes
-----

This function extends only enumerable properties without going up the prototype chain.


License
-------
MIT.

---
_Source: https://npm.io/package/object-extend · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
