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

@augment-vir/common

Package Overview
Dependencies
Maintainers
1
Versions
222
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@augment-vir/common - npm Package Compare versions

Comparing version 21.0.1 to 21.1.0

35

dist/cjs/augments/object/merge-deep.js

@@ -6,2 +6,3 @@ "use strict";

const tuple_1 = require("../tuple");
const object_1 = require("./object");
/**

@@ -14,24 +15,36 @@ * Accepts multiple objects and merges their key-value pairs recursively.

if (!(0, tuple_1.isLengthAtLeast)(inputs, 1)) {
// nothing to merge if no inputs
return {};
}
if (inputs.length === 1) {
// nothing to merge if only one input
return inputs[0];
}
let result = {};
let result = undefined;
const mergeProps = {};
inputs.forEach((individualInput) => {
try {
if (!(0, object_1.isObject)(individualInput)) {
/** If not an object, we can't merge. So overwrite instead. */
result = individualInput;
return;
}
Object.entries(individualInput).forEach(([key, value,]) => {
if ((0, runtime_type_of_1.isRuntimeTypeOf)(value, 'object')) {
const mergePropsArray = mergeProps[key] || [];
if (!mergeProps[key]) {
mergeProps[key] = mergePropsArray;
}
mergePropsArray.push(value);
const mergePropsArray = mergeProps[key] || [];
if (!mergeProps[key]) {
mergeProps[key] = mergePropsArray;
}
mergePropsArray.push(value);
});
result = {
...result,
...individualInput,
};
if (result) {
if ((0, runtime_type_of_1.isRuntimeTypeOf)(result, 'object')) {
result = {
...result,
...individualInput,
};
}
}
else {
result = individualInput;
}
}

@@ -38,0 +51,0 @@ catch (error) {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.copyThroughJson = exports.isObject = void 0;
/** Checks if the input is non-null and an object. Includes arrays. */
function isObject(input) {

@@ -5,0 +6,0 @@ return !!input && typeof input === 'object';

import { isRuntimeTypeOf } from '../runtime-type-of';
import { isLengthAtLeast } from '../tuple';
import { isObject } from './object';
/**

@@ -10,24 +11,36 @@ * Accepts multiple objects and merges their key-value pairs recursively.

if (!isLengthAtLeast(inputs, 1)) {
// nothing to merge if no inputs
return {};
}
if (inputs.length === 1) {
// nothing to merge if only one input
return inputs[0];
}
let result = {};
let result = undefined;
const mergeProps = {};
inputs.forEach((individualInput) => {
try {
if (!isObject(individualInput)) {
/** If not an object, we can't merge. So overwrite instead. */
result = individualInput;
return;
}
Object.entries(individualInput).forEach(([key, value,]) => {
if (isRuntimeTypeOf(value, 'object')) {
const mergePropsArray = mergeProps[key] || [];
if (!mergeProps[key]) {
mergeProps[key] = mergePropsArray;
}
mergePropsArray.push(value);
const mergePropsArray = mergeProps[key] || [];
if (!mergeProps[key]) {
mergeProps[key] = mergePropsArray;
}
mergePropsArray.push(value);
});
result = {
...result,
...individualInput,
};
if (result) {
if (isRuntimeTypeOf(result, 'object')) {
result = {
...result,
...individualInput,
};
}
}
else {
result = individualInput;
}
}

@@ -34,0 +47,0 @@ catch (error) {

@@ -0,1 +1,2 @@

/** Checks if the input is non-null and an object. Includes arrays. */
export function isObject(input) {

@@ -2,0 +3,0 @@ return !!input && typeof input === 'object';

@@ -7,2 +7,3 @@ export type PartialAndNullable<T extends object> = {

};
/** Checks if the input is non-null and an object. Includes arrays. */
export declare function isObject(input: any): input is NonNullable<object>;

@@ -9,0 +10,0 @@ /** The input here must be serializable otherwise JSON parsing errors will be thrown */

{
"name": "@augment-vir/common",
"version": "21.0.1",
"version": "21.1.0",
"homepage": "https://github.com/electrovir/augment-vir/tree/main/packages/common",

@@ -5,0 +5,0 @@ "bugs": {

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