1.1.2 • Published 4 years ago

deepmerge-concat v1.1.2

Weekly downloads
126
License
MIT
Repository
github
Last release
4 years ago

This package is an extension of deepmerge

Adds capability to concat strings and arrays whilst merging two objects

USAGE:

First import package into project

npm install deepmerge-concat --save

Example:

const deepmerge = require('deepmerge-concat');

const obj1 = {
  include: 'one,two,three',
  fields: 'one,two,three',
  sort: {
    test: 'one,two,three',
    arr: ['one', 'two', 'three']
  },
  help: false
};

const obj2 = {
  include: 'four,five',
  fields: 'four,five',
  sort: {
    test: 'four,five',
    arr: ['four', 'five'],
  },
  help: true
};

deepmerge.concat(obj1, obj2);

Result:

{
  "include": "one,two,three,four,five",
  "fields": "one,two,three,four,five",
  "sort": {
    "test": "one,two,three,four,five",
    "arr": ["one","two","three","four","five"]
  },
  "help": true
}

As you can see this concats and string/array values found within the nested objects.

Other primitives (e.g. numbers/bools) are still overwritten as per deepmerge functionality.

1.1.2

4 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.16

5 years ago

1.0.15

5 years ago

1.0.14

5 years ago

1.0.13

5 years ago

1.0.12

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago