Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

@remy/merge

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@remy/merge - npm Package Compare versions

Comparing version
1.0.1
to
1.0.2
+28
README.md
# What?
Another merge library, but I had a need to support merging objects who also had array properties (where as lodash's merge doesn't merge arrays, only objects).
Features:
- Deep merge
- Object merging
- Array merge
- Priority from right to left
# Install
```
npm install --save @remy/merge
```
# Usage
```
const result = merge(a, b);
```
Both `a` and `b` are untouched (i.e. this method doesn't mutate).
If a the same key appears as a primitive in `a` and `b`, then the value from `b` is in the result.
If the same key appears as an array or as an object, the result is the merged result.
+2
-5

@@ -13,8 +13,5 @@ var clone = require('./clone');

* @param {Object} target [description]
* @return {Object} [description]
*/
function merge(source, target, result) {
if (result === undefined) {
result = clone(source);
}
function merge(source, target) {
var result = clone(source);

@@ -21,0 +18,0 @@ // merge missing values from the target to the source

{
"name": "@remy/merge",
"version": "1.0.1",
"version": "1.0.2",
"description": "Merge - like most tools, except also supports arrays",
"main": "merge.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "node __tests__/*.test.js"
},
"files": [
"clone.js",
"merge.js"
],
"keywords": [],
"author": "Remy Sharp (https://remysharp.com)",
"license": "MIT"
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/remy/merge.git"
},
"bugs": {
"url": "https://github.com/remy/merge/issues"
},
"homepage": "https://github.com/remy/merge#readme"
}
var merge = require('../');
const a = {
env: {
browser: true,
es6: true,
commonjs: true,
},
extends: ['eslint:recommended'],
parser: 'babel-eslint',
parserOptions: {
ecmaVersion: 8,
ecmaFeatures: {
jsx: true,
},
sourceType: 'module',
},
plugins: ['react', 'node'],
rules: {
'react/prop-types': 0,
'react/jsx-uses-vars': [2],
},
};
const b = {
plugins: [true],
rules: { a: 1 },
};
console.log(merge(a, b).rules);