You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@contrail/util

Package Overview
Dependencies
Maintainers
4
Versions
126
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@contrail/util - npm Package Compare versions

Comparing version

to
1.0.10

lib/object-util.merge.spec.d.ts

2

lib/object-util.d.ts
export declare class ObjectUtil {
static getByPath(obj: any, path: string, def?: any): any;
static setByPath(obj: any, path: string, value: any): void;
static isObject(item: any): boolean;
static mergeDeep(target: any, ...sources: any[]): any;
}

@@ -31,3 +31,24 @@ "use strict";

}
static isObject(item) {
return (item && typeof item === 'object' && !Array.isArray(item));
}
static mergeDeep(target, ...sources) {
if (!sources.length)
return target;
const source = sources.shift();
if (this.isObject(target) && this.isObject(source)) {
for (const key in source) {
if (this.isObject(source[key])) {
if (!target[key])
Object.assign(target, { [key]: {} });
this.mergeDeep(target[key], source[key]);
}
else {
Object.assign(target, { [key]: source[key] });
}
}
}
return this.mergeDeep(target, ...sources);
}
}
exports.ObjectUtil = ObjectUtil;

2

package.json
{
"name": "@contrail/util",
"version": "1.0.9",
"version": "1.0.10",
"description": "General javascript utilities",

@@ -5,0 +5,0 @@ "main": "lib/index.js",