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

@fastify/deepmerge

Package Overview
Dependencies
Maintainers
18
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fastify/deepmerge - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

20

index.js

@@ -112,7 +112,17 @@ 'use strict'

for (i = 0, il = sourceKeys.length; i < il; ++i) {
isNotPrototypeKey(key = sourceKeys[i]) &&
(
key in target && (targetKeys.indexOf(key) !== -1 && (result[key] = _deepmerge(target[key], source[key])), true) || // eslint-disable-line no-mixed-operators
(result[key] = clone(source[key]))
)
if (!isNotPrototypeKey(key = sourceKeys[i])) {
continue
}
if (key in target) {
if (targetKeys.indexOf(key) !== -1) {
if (cloneProtoObject && isMergeableObject(source[key]) && Object.getPrototypeOf(source[key]) !== JSON_PROTO) {
result[key] = cloneProtoObject(source[key])
} else {
result[key] = _deepmerge(target[key], source[key])
}
}
} else {
result[key] = clone(source[key])
}
}

@@ -119,0 +129,0 @@ return result

{
"name": "@fastify/deepmerge",
"version": "2.0.0",
"version": "2.0.1",
"description": "Merges the enumerable properties of two or more objects deeply.",

@@ -9,4 +9,4 @@ "main": "index.js",

"scripts": {
"lint": "standard",
"lint:fix": "standard --fix",
"lint": "eslint",
"lint:fix": "eslint --fix",
"test": "npm run test:unit && npm run test:typescript",

@@ -20,3 +20,22 @@ "test:unit": "tap",

},
"author": "",
"author": "Aras Abbasi <aras.abbasi@gmail.com>",
"contributors": [
{
"name": "Matteo Collina",
"email": "hello@matteocollina.com"
},
{
"name": "Manuel Spigolon",
"email": "behemoth89@gmail.com"
},
{
"name": "James Sumners",
"url": "https://james.sumners.info"
},
{
"name": "Frazer Smith",
"email": "frazer.dev@icloud.com",
"url": "https://github.com/fdawgs"
}
],
"license": "MIT",

@@ -27,7 +46,18 @@ "bugs": {

"homepage": "https://github.com/fastify/deepmerge#readme",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/fastify"
},
{
"type": "opencollective",
"url": "https://opencollective.com/fastify"
}
],
"devDependencies": {
"standard": "^17.1.0",
"tap": "^18.7.1",
"eslint": "^9.17.0",
"neostandard": "^0.12.0",
"tap": "^21.0.0",
"tape": "^5.7.5",
"tsd": "^0.30.7"
"tsd": "^0.31.1"
},

@@ -34,0 +64,0 @@ "files": [

# @fastify/deepmerge
![CI](https://github.com/fastify/deepmerge/workflows/CI/badge.svg)
[![CI](https://github.com/fastify/deepmerge/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/fastify/deepmerge/actions/workflows/ci.yml)
[![NPM version](https://img.shields.io/npm/v/@fastify/deepmerge.svg?style=flat)](https://www.npmjs.com/package/@fastify/deepmerge)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://standardjs.com/)
[![neostandard javascript style](https://img.shields.io/badge/code_style-neostandard-brightgreen?style=flat)](https://github.com/neostandard/neostandard)

@@ -16,3 +16,3 @@ Merges the enumerable properties of two or more objects deeply. Fastest implementation of deepmerge, see section 'Benchmarks'.

The module exports a function, which provides a function to deepmerge Objects.
The module exports a function, which provides a function to deepmerge Objects.

@@ -65,3 +65,3 @@ ```

The `mergeArray`-Function needs to return the actual Array merging function, which accepts two parameters of type
The `mergeArray`-Function needs to return the actual Array merging function, which accepts two parameters of type
Array, and returns a value.

@@ -138,3 +138,3 @@

The benchmarks are available in the benchmark-folder.
The benchmarks are available in the benchmark-folder.

@@ -141,0 +141,0 @@ `npm run bench` - benchmark various use cases of deepmerge:

@@ -1,3 +0,3 @@

type DeepMergeFn = <T1, T2>(target: T1, source: T2) => DeepMerge<T1, T2>;
type DeepMergeAllFn = <T extends Array<any>>(...targets: T) => DeepMergeAll<{}, T>;
type DeepMergeFn = <T1, T2>(target: T1, source: T2) => DeepMerge<T1, T2>
type DeepMergeAllFn = <T extends Array<any>>(...targets: T) => DeepMergeAll<{}, T>

@@ -11,11 +11,11 @@ type Primitive =

| symbol
| bigint;
| bigint
type BuiltIns = Primitive | Date | RegExp;
type BuiltIns = Primitive | Date | RegExp
type MergeArrays<T, U> = T extends readonly any[]
? U extends readonly any[]
? [...T, ...U]
? [...T, ...U]
: never
: never
: never

@@ -41,10 +41,13 @@ type DifferenceKeys<

U extends BuiltIns
? U
: [T, U] extends [readonly any[], readonly any[]]
? MergeArrays<T, U>
: [T, U] extends [{ [key: string]: unknown }, { [key: string]: unknown }]
? DeepMergeHelper<T, U>
: U
? U
: [T, U] extends [readonly any[], readonly any[]]
? MergeArrays<T, U>
: [T, U] extends [{ [key: string]: unknown }, { [key: string]: unknown }]
? DeepMergeHelper<T, U>
: U
type First<T> = T extends [infer _I, ...infer _Rest] ? _I : never;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
type First<T> = T extends [infer _I, ...infer _Rest] ? _I : never
// eslint-disable-next-line @typescript-eslint/no-unused-vars
type Rest<T> = T extends [infer _I, ...infer _Rest] ? _Rest : never

@@ -54,3 +57,3 @@

? R
: DeepMergeAll<DeepMerge<R, First<T>>, Rest<T>>;
: DeepMergeAll<DeepMerge<R, First<T>>, Rest<T>>

@@ -80,5 +83,5 @@ type MergeArrayFnOptions = {

declare function deepmerge(options: Options & { all: true }): DeepMergeAllFn;
declare function deepmerge(options?: Options): DeepMergeFn;
declare function deepmerge (options: Options & { all: true }): DeepMergeAllFn
declare function deepmerge (options?: Options): DeepMergeFn
export = deepmerge
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