@jalik/deep-extend
Advanced tools
Comparing version 1.2.2 to 2.0.0
"use strict"; | ||
/* | ||
* The MIT License (MIT) | ||
* Copyright (c) 2023 Karl STEIN | ||
* Copyright (c) 2024 Karl STEIN | ||
*/ | ||
@@ -49,3 +49,3 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
var b = args[i]; | ||
if (a !== null && b !== null && typeof a !== 'undefined' && typeof b !== 'undefined') { | ||
if (a != null && b != null) { | ||
// Merge objects | ||
@@ -74,6 +74,9 @@ if (typeof a === 'object' && typeof b === 'object') { | ||
} | ||
else if (b !== null && typeof b !== 'undefined') { | ||
else if (b != null) { | ||
if (b instanceof Array) { | ||
a = mergeArrays([], b, deepExtend); | ||
} | ||
else if (typeof b === 'object') { | ||
a = deepExtend({}, b); | ||
} | ||
else { | ||
@@ -80,0 +83,0 @@ a = b; |
/* | ||
* The MIT License (MIT) | ||
* Copyright (c) 2023 Karl STEIN | ||
* Copyright (c) 2024 Karl STEIN | ||
*/ | ||
@@ -43,3 +43,3 @@ /** | ||
const b = args[i]; | ||
if (a !== null && b !== null && typeof a !== 'undefined' && typeof b !== 'undefined') { | ||
if (a != null && b != null) { | ||
// Merge objects | ||
@@ -68,6 +68,9 @@ if (typeof a === 'object' && typeof b === 'object') { | ||
} | ||
else if (b !== null && typeof b !== 'undefined') { | ||
else if (b != null) { | ||
if (b instanceof Array) { | ||
a = mergeArrays([], b, deepExtend); | ||
} | ||
else if (typeof b === 'object') { | ||
a = deepExtend({}, b); | ||
} | ||
else { | ||
@@ -74,0 +77,0 @@ a = b; |
{ | ||
"name": "@jalik/deep-extend", | ||
"version": "1.2.2", | ||
"description": "A utility to merge deep objects.", | ||
"version": "2.0.0", | ||
"description": "Deep merge any objects", | ||
"license": "MIT", | ||
@@ -44,16 +44,16 @@ "keywords": [ | ||
"devDependencies": { | ||
"@babel/cli": "^7.21.5", | ||
"@babel/preset-env": "^7.21.5", | ||
"@babel/preset-typescript": "^7.21.5", | ||
"@jest/globals": "^29.5.0", | ||
"@babel/cli": "^7.25.9", | ||
"@babel/preset-env": "^7.26.0", | ||
"@babel/preset-typescript": "^7.26.0", | ||
"@jest/globals": "^29.7.0", | ||
"@typescript-eslint/eslint-plugin": "^5.59.2", | ||
"@typescript-eslint/parser": "^5.59.2", | ||
"eslint": "^8.39.0", | ||
"eslint-config-standard": "^17.0.0", | ||
"eslint-plugin-import": "^2.24.2", | ||
"eslint-plugin-jest": "^27.2.1", | ||
"jest": "^29.5.0", | ||
"rimraf": "^5.0.0", | ||
"typescript": "^5.0.4" | ||
"eslint": "^8.57.1", | ||
"eslint-config-standard": "^17.1.0", | ||
"eslint-plugin-import": "^2.31.0", | ||
"eslint-plugin-jest": "^27.9.0", | ||
"jest": "^29.7.0", | ||
"rimraf": "^6.0.1", | ||
"typescript": "^5.6.3" | ||
} | ||
} |
@@ -10,8 +10,17 @@ # @jalik/deep-extend | ||
A utility to merge deep objects. | ||
Deep merge any objects. | ||
## Introduction | ||
## Sandbox | ||
Use it when you need to merge nested objects. | ||
Play with the lib here: https://codesandbox.io/s/jalik-deep-extend-demo-wyeo99?file=/src/index.js | ||
## Installing | ||
```shell | ||
npm i -P @jalik/deep-extend | ||
``` | ||
```shell | ||
yarn add @jalik/deep-extend | ||
``` | ||
## Merging deep objects | ||
@@ -18,0 +27,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15603
180
111