Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@naturalcycles/js-lib

Package Overview
Dependencies
Maintainers
3
Versions
525
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@naturalcycles/js-lib - npm Package Compare versions

Comparing version 8.0.1 to 8.1.0

7

CHANGELOG.md

@@ -0,1 +1,8 @@

# [8.1.0](https://github.com/NaturalCycles/js-lib/compare/v8.0.1...v8.1.0) (2019-07-16)
### Features
* _merge with multiple sources ([e109b4f](https://github.com/NaturalCycles/js-lib/commit/e109b4f))
## [8.0.1](https://github.com/NaturalCycles/js-lib/compare/v8.0.0...v8.0.1) (2019-07-16)

@@ -2,0 +9,0 @@

32

dist-esm/util/object.util.js

@@ -116,3 +116,3 @@ /**

* @param target The destination object.
* @param source The source object.
* @param sources The source objects.
* @returns Returns `object`.

@@ -134,15 +134,19 @@ * @example

*/
export function _merge(target, source) {
if (isObject(target) && isObject(source)) {
Object.keys(source).forEach(key => {
if (isObject(source[key])) {
if (!target[key])
Object.assign(target, { [key]: {} });
_merge(target[key], source[key]);
}
else {
Object.assign(target, { [key]: source[key] });
}
});
}
export function _merge(target, ...sources) {
if (!isObject(target))
return target;
sources.forEach(source => {
if (isObject(source)) {
Object.keys(source).forEach(key => {
if (isObject(source[key])) {
if (!target[key])
Object.assign(target, { [key]: {} });
_merge(target[key], source[key]);
}
else {
Object.assign(target, { [key]: source[key] });
}
});
}
});
return target;

@@ -149,0 +153,0 @@ }

@@ -57,3 +57,3 @@ import { Except } from 'type-fest';

* @param target The destination object.
* @param source The source object.
* @param sources The source objects.
* @returns Returns `object`.

@@ -75,3 +75,3 @@ * @example

*/
export declare function _merge<TARGET, SOURCE>(target: TARGET, source: SOURCE): TARGET & SOURCE;
export declare function _merge<T>(target: T, ...sources: any[]): T;
/**

@@ -78,0 +78,0 @@ * Mutates

@@ -132,3 +132,3 @@ "use strict";

* @param target The destination object.
* @param source The source object.
* @param sources The source objects.
* @returns Returns `object`.

@@ -150,15 +150,19 @@ * @example

*/
function _merge(target, source) {
if (isObject(target) && isObject(source)) {
Object.keys(source).forEach(key => {
if (isObject(source[key])) {
if (!target[key])
Object.assign(target, { [key]: {} });
_merge(target[key], source[key]);
}
else {
Object.assign(target, { [key]: source[key] });
}
});
}
function _merge(target, ...sources) {
if (!isObject(target))
return target;
sources.forEach(source => {
if (isObject(source)) {
Object.keys(source).forEach(key => {
if (isObject(source[key])) {
if (!target[key])
Object.assign(target, { [key]: {} });
_merge(target[key], source[key]);
}
else {
Object.assign(target, { [key]: source[key] });
}
});
}
});
return target;

@@ -165,0 +169,0 @@ }

{
"name": "@naturalcycles/js-lib",
"version": "8.0.1",
"version": "8.1.0",
"scripts": {

@@ -5,0 +5,0 @@ "build": "del ./dist && tsc",

@@ -160,3 +160,3 @@ import { Except } from 'type-fest'

* @param target The destination object.
* @param source The source object.
* @param sources The source objects.
* @returns Returns `object`.

@@ -178,14 +178,19 @@ * @example

*/
export function _merge<TARGET, SOURCE> (target: TARGET, source: SOURCE): TARGET & SOURCE {
if (isObject(target) && isObject(source)) {
Object.keys(source).forEach(key => {
if (isObject(source[key])) {
if (!target[key]) Object.assign(target, { [key]: {} })
_merge(target[key], source[key])
} else {
Object.assign(target, { [key]: source[key] })
}
})
}
return target as TARGET & SOURCE
export function _merge<T> (target: T, ...sources: any[]): T {
if (!isObject(target)) return target
sources.forEach(source => {
if (isObject(source)) {
Object.keys(source).forEach(key => {
if (isObject(source[key])) {
if (!target[key]) Object.assign(target, { [key]: {} })
_merge(target[key], source[key])
} else {
Object.assign(target, { [key]: source[key] })
}
})
}
})
return target
}

@@ -192,0 +197,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc