Skip to content

Commit

Permalink
chore(release): 4.0.4 [skip ci]
Browse files Browse the repository at this point in the history
## [4.0.4](v4.0.3...v4.0.4) (2022-06-13)

### Bug Fixes

* drop keys that have no enumerable properties ([3363570](3363570))
  • Loading branch information
semantic-release-bot committed Jun 13, 2022
1 parent 73f0940 commit 6becb68
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 32 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Changelog
All notable changes to this project will be documented in this file. Dates are displayed in UTC.

## [4.0.4](https://github.com/RebeccaStevens/deepmerge-ts/compare/v4.0.3...v4.0.4) (2022-06-13)


### Bug Fixes

* drop keys that have no enumerable properties ([3363570](https://github.com/RebeccaStevens/deepmerge-ts/commit/3363570fcc53488d22a2d4b778b558173c7ee5c9))

## [4.0.3](https://github.com/RebeccaStevens/deepmerge-ts/compare/v4.0.2...v4.0.3) (2022-04-06)


Expand Down
8 changes: 5 additions & 3 deletions dist/deno/deepmerge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,8 @@ function mergeUnknowns<
// eslint-disable-next-line functional/no-conditional-statement -- add an early escape for better performance.
if (type !== ObjectType.NOT && type !== ObjectType.OTHER) {
// eslint-disable-next-line functional/no-loop-statement -- using a loop here is more performant than mapping every value and then testing every value.
for (let mutableIndex = 1; mutableIndex < values.length; mutableIndex++) {
if (getObjectType(values[mutableIndex]) === type) {
for (let m_index = 1; m_index < values.length; m_index++) {
if (getObjectType(values[m_index]) === type) {
continue;
}

Expand Down Expand Up @@ -425,7 +425,9 @@ function defaultMergeRecords<
}
}

// assert(propValues.length > 0);
if (propValues.length === 0) {
continue;
}

const updatedMeta = utils.metaDataUpdater(meta, {
key,
Expand Down
2 changes: 1 addition & 1 deletion dist/deno/types/options.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// eslint-disable-next-line import/no-relative-parent-imports -- use "@/deepmerge" once denoify can support it.
// eslint-disable-next-line import/no-relative-parent-imports -- use "deepmerge-ts" once denoify can support it.
import type { DeepMergeMergeFunctionsDefaults } from "../index.ts";

import type { DeepMergeBuiltInMetaData } from "./merging.ts";
Expand Down
30 changes: 16 additions & 14 deletions dist/node/index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@ var isPlainObject = require('is-plain-object');
*/
function getObjectType(object) {
if (typeof object !== "object" || object === null) {
return 0 /* NOT */;
return 0 /* ObjectType.NOT */;
}
if (Array.isArray(object)) {
return 2 /* ARRAY */;
return 2 /* ObjectType.ARRAY */;
}
if (isPlainObject.isPlainObject(object)) {
return 1 /* RECORD */;
return 1 /* ObjectType.RECORD */;
}
if (object instanceof Set) {
return 3 /* SET */;
return 3 /* ObjectType.SET */;
}
if (object instanceof Map) {
return 4 /* MAP */;
return 4 /* ObjectType.MAP */;
}
return 5 /* OTHER */;
return 5 /* ObjectType.OTHER */;
}
/**
* Get the keys of the given objects including symbol keys.
Expand Down Expand Up @@ -151,23 +151,23 @@ function mergeUnknowns(values, utils, meta) {
}
const type = getObjectType(values[0]);
// eslint-disable-next-line functional/no-conditional-statement -- add an early escape for better performance.
if (type !== 0 /* NOT */ && type !== 5 /* OTHER */) {
if (type !== 0 /* ObjectType.NOT */ && type !== 5 /* ObjectType.OTHER */) {
// eslint-disable-next-line functional/no-loop-statement -- using a loop here is more performant than mapping every value and then testing every value.
for (let mutableIndex = 1; mutableIndex < values.length; mutableIndex++) {
if (getObjectType(values[mutableIndex]) === type) {
for (let m_index = 1; m_index < values.length; m_index++) {
if (getObjectType(values[m_index]) === type) {
continue;
}
return mergeOthers(values, utils, meta);
}
}
switch (type) {
case 1 /* RECORD */:
case 1 /* ObjectType.RECORD */:
return mergeRecords(values, utils, meta);
case 2 /* ARRAY */:
case 2 /* ObjectType.ARRAY */:
return mergeArrays(values, utils, meta);
case 3 /* SET */:
case 3 /* ObjectType.SET */:
return mergeSets(values, utils, meta);
case 4 /* MAP */:
case 4 /* ObjectType.MAP */:
return mergeMaps(values, utils, meta);
default:
return mergeOthers(values, utils, meta);
Expand Down Expand Up @@ -266,7 +266,9 @@ function defaultMergeRecords(values, utils, meta) {
propValues.push(value[key]);
}
}
// assert(propValues.length > 0);
if (propValues.length === 0) {
continue;
}
const updatedMeta = utils.metaDataUpdater(meta, {
key,
parents: values,
Expand Down
30 changes: 16 additions & 14 deletions dist/node/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@ import { isPlainObject } from 'is-plain-object';
*/
function getObjectType(object) {
if (typeof object !== "object" || object === null) {
return 0 /* NOT */;
return 0 /* ObjectType.NOT */;
}
if (Array.isArray(object)) {
return 2 /* ARRAY */;
return 2 /* ObjectType.ARRAY */;
}
if (isPlainObject(object)) {
return 1 /* RECORD */;
return 1 /* ObjectType.RECORD */;
}
if (object instanceof Set) {
return 3 /* SET */;
return 3 /* ObjectType.SET */;
}
if (object instanceof Map) {
return 4 /* MAP */;
return 4 /* ObjectType.MAP */;
}
return 5 /* OTHER */;
return 5 /* ObjectType.OTHER */;
}
/**
* Get the keys of the given objects including symbol keys.
Expand Down Expand Up @@ -147,23 +147,23 @@ function mergeUnknowns(values, utils, meta) {
}
const type = getObjectType(values[0]);
// eslint-disable-next-line functional/no-conditional-statement -- add an early escape for better performance.
if (type !== 0 /* NOT */ && type !== 5 /* OTHER */) {
if (type !== 0 /* ObjectType.NOT */ && type !== 5 /* ObjectType.OTHER */) {
// eslint-disable-next-line functional/no-loop-statement -- using a loop here is more performant than mapping every value and then testing every value.
for (let mutableIndex = 1; mutableIndex < values.length; mutableIndex++) {
if (getObjectType(values[mutableIndex]) === type) {
for (let m_index = 1; m_index < values.length; m_index++) {
if (getObjectType(values[m_index]) === type) {
continue;
}
return mergeOthers(values, utils, meta);
}
}
switch (type) {
case 1 /* RECORD */:
case 1 /* ObjectType.RECORD */:
return mergeRecords(values, utils, meta);
case 2 /* ARRAY */:
case 2 /* ObjectType.ARRAY */:
return mergeArrays(values, utils, meta);
case 3 /* SET */:
case 3 /* ObjectType.SET */:
return mergeSets(values, utils, meta);
case 4 /* MAP */:
case 4 /* ObjectType.MAP */:
return mergeMaps(values, utils, meta);
default:
return mergeOthers(values, utils, meta);
Expand Down Expand Up @@ -262,7 +262,9 @@ function defaultMergeRecords(values, utils, meta) {
propValues.push(value[key]);
}
}
// assert(propValues.length > 0);
if (propValues.length === 0) {
continue;
}
const updatedMeta = utils.metaDataUpdater(meta, {
key,
parents: values,
Expand Down

0 comments on commit 6becb68

Please sign in to comment.