New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More →

@saulx/utils

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@saulx/utils - npm Package Compare versions

Comparing version

to
1.0.8

{
"name": "@saulx/utils",
"main": "./dist/index.js",
"version": "1.0.7",
"version": "1.0.8",
"scripts": {

@@ -6,0 +6,0 @@ "build": "tsc",

const merge = (target: any, source: any) => {
if (
target &&
typeof target === 'object' &&
source &&
typeof source === 'object'
) {
if (source.constructor === Array) {
for (let i = 0; i < source.length; i++) {
if (i in target) {
if (
target[i] &&
typeof target[i] === 'object' &&
source[i] &&
typeof source[i] === 'object'
) {
merge(target[i], source[i])
} else {
target[i] = source[i]
}
if (source.constructor === Array) {
for (let i = 0; i < source.length; i++) {
if (i in target) {
if (
target[i] &&
typeof target[i] === 'object' &&
source[i] &&
typeof source[i] === 'object'
) {
merge(target[i], source[i])
} else {
target[i] = source[i]
}
} else {
target[i] = source[i]
}
} else {
for (const i in source) {
if (i in target) {
if (
target[i] &&
typeof target[i] === 'object' &&
source[i] &&
typeof source[i] === 'object'
) {
merge(target[i], source[i])
} else {
target[i] = source[i]
}
}
} else {
for (const i in source) {
if (i in target) {
if (
target[i] &&
typeof target[i] === 'object' &&
source[i] &&
typeof source[i] === 'object'
) {
merge(target[i], source[i])
} else {
target[i] = source[i]
}
} else {
target[i] = source[i]
}

@@ -49,7 +42,24 @@ }

if (sources.length === 1) {
merge(target, sources[0])
return target
const source = sources[0]
if (
target &&
typeof target === 'object' &&
source &&
typeof source === 'object'
) {
merge(target, source)
return target
}
}
for (let i = 0; i < sources.length; i++) {
merge(target, sources[i])
const source = sources[i]
if (
target &&
typeof target === 'object' &&
source &&
typeof source === 'object'
) {
merge(target, source)
return target
}
}

@@ -60,27 +70,18 @@ return target

const mergeExcludeArray = (target: any, source: any): any => {
if (
target &&
typeof target === 'object' &&
source &&
typeof source === 'object'
) {
if (source.constructor === Array || target.constructor === Array) {
return source
} else {
for (const i in source) {
if (i in target) {
if (
target[i] &&
source[i] &&
typeof target[i] === 'object' &&
target[i].constructor !== Array &&
typeof source[i] === 'object' &&
source[i].constructor !== Array
) {
const a = mergeExcludeArray(target[i], source[i])
if (a !== target[i]) {
target[i] = a
}
} else {
target[i] = source[i]
if (source.constructor === Array || target.constructor === Array) {
return source
} else {
for (const i in source) {
if (i in target) {
if (
target[i] &&
source[i] &&
typeof target[i] === 'object' &&
target[i].constructor !== Array &&
typeof source[i] === 'object' &&
source[i].constructor !== Array
) {
const a = mergeExcludeArray(target[i], source[i])
if (a !== target[i]) {
target[i] = a
}

@@ -90,2 +91,4 @@ } else {

}
} else {
target[i] = source[i]
}

@@ -100,8 +103,24 @@ }

if (sources.length === 1) {
return mergeExcludeArray(target, sources[0])
const source = sources[0]
if (
target &&
typeof target === 'object' &&
source &&
typeof source === 'object'
) {
return mergeExcludeArray(target, source)
}
}
for (let i = 0; i < sources.length; i++) {
const a = mergeExcludeArray(target, sources[i])
if (a !== target) {
target = a
const source = sources[i]
if (
target &&
typeof target === 'object' &&
source &&
typeof source === 'object'
) {
const a = mergeExcludeArray(target, source)
if (a !== target) {
target = a
}
}

@@ -108,0 +127,0 @@ }