smart-merge

Deep merge any number of javascript objects.

Usage no npm install needed!

<script type="module">
  import smartMerge from 'https://cdn.skypack.dev/smart-merge';
</script>

README

Merge multiple Javascript objects

Deep merge any number of javascript objects.

NPM

install

npm install smart-merge

Usage

    var baseStyles = {
        header: {
            left: 10,
            position: 'absolute',
        },
        footer: {
            right: 10
        }
    };
    var rtlStyles = {
        header: {
            left: 40,
        }
    };
    var merge = require('smart-merge');
    merge(baseStyles, rtlStyles);

Result

{ 
    header:{ 
        left: 40, 
        position: 'absolute' 
    }, 
    footer:{ 
        right: 10 
    } 
}

Tests

Check the tests for more examples...