Skip to content

Commit 6becb68

Browse files
chore(release): 4.0.4 [skip ci]
## [4.0.4](v4.0.3...v4.0.4) (2022-06-13) ### Bug Fixes * drop keys that have no enumerable properties ([3363570](3363570))
1 parent 73f0940 commit 6becb68

5 files changed

Lines changed: 45 additions & 32 deletions

File tree

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
# Changelog
22
All notable changes to this project will be documented in this file. Dates are displayed in UTC.
33

4+
## [4.0.4](https://github.com/RebeccaStevens/deepmerge-ts/compare/v4.0.3...v4.0.4) (2022-06-13)
5+
6+
7+
### Bug Fixes
8+
9+
* drop keys that have no enumerable properties ([3363570](https://github.com/RebeccaStevens/deepmerge-ts/commit/3363570fcc53488d22a2d4b778b558173c7ee5c9))
10+
411
## [4.0.3](https://github.com/RebeccaStevens/deepmerge-ts/compare/v4.0.2...v4.0.3) (2022-04-06)
512

613

dist/deno/deepmerge.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,8 @@ function mergeUnknowns<
203203
// eslint-disable-next-line functional/no-conditional-statement -- add an early escape for better performance.
204204
if (type !== ObjectType.NOT && type !== ObjectType.OTHER) {
205205
// eslint-disable-next-line functional/no-loop-statement -- using a loop here is more performant than mapping every value and then testing every value.
206-
for (let mutableIndex = 1; mutableIndex < values.length; mutableIndex++) {
207-
if (getObjectType(values[mutableIndex]) === type) {
206+
for (let m_index = 1; m_index < values.length; m_index++) {
207+
if (getObjectType(values[m_index]) === type) {
208208
continue;
209209
}
210210

@@ -425,7 +425,9 @@ function defaultMergeRecords<
425425
}
426426
}
427427

428-
// assert(propValues.length > 0);
428+
if (propValues.length === 0) {
429+
continue;
430+
}
429431

430432
const updatedMeta = utils.metaDataUpdater(meta, {
431433
key,

dist/deno/types/options.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// eslint-disable-next-line import/no-relative-parent-imports -- use "@/deepmerge" once denoify can support it.
1+
// eslint-disable-next-line import/no-relative-parent-imports -- use "deepmerge-ts" once denoify can support it.
22
import type { DeepMergeMergeFunctionsDefaults } from "../index.ts";
33

44
import type { DeepMergeBuiltInMetaData } from "./merging.ts";

dist/node/index.cjs

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,21 @@ var isPlainObject = require('is-plain-object');
1212
*/
1313
function getObjectType(object) {
1414
if (typeof object !== "object" || object === null) {
15-
return 0 /* NOT */;
15+
return 0 /* ObjectType.NOT */;
1616
}
1717
if (Array.isArray(object)) {
18-
return 2 /* ARRAY */;
18+
return 2 /* ObjectType.ARRAY */;
1919
}
2020
if (isPlainObject.isPlainObject(object)) {
21-
return 1 /* RECORD */;
21+
return 1 /* ObjectType.RECORD */;
2222
}
2323
if (object instanceof Set) {
24-
return 3 /* SET */;
24+
return 3 /* ObjectType.SET */;
2525
}
2626
if (object instanceof Map) {
27-
return 4 /* MAP */;
27+
return 4 /* ObjectType.MAP */;
2828
}
29-
return 5 /* OTHER */;
29+
return 5 /* ObjectType.OTHER */;
3030
}
3131
/**
3232
* Get the keys of the given objects including symbol keys.
@@ -151,23 +151,23 @@ function mergeUnknowns(values, utils, meta) {
151151
}
152152
const type = getObjectType(values[0]);
153153
// eslint-disable-next-line functional/no-conditional-statement -- add an early escape for better performance.
154-
if (type !== 0 /* NOT */ && type !== 5 /* OTHER */) {
154+
if (type !== 0 /* ObjectType.NOT */ && type !== 5 /* ObjectType.OTHER */) {
155155
// eslint-disable-next-line functional/no-loop-statement -- using a loop here is more performant than mapping every value and then testing every value.
156-
for (let mutableIndex = 1; mutableIndex < values.length; mutableIndex++) {
157-
if (getObjectType(values[mutableIndex]) === type) {
156+
for (let m_index = 1; m_index < values.length; m_index++) {
157+
if (getObjectType(values[m_index]) === type) {
158158
continue;
159159
}
160160
return mergeOthers(values, utils, meta);
161161
}
162162
}
163163
switch (type) {
164-
case 1 /* RECORD */:
164+
case 1 /* ObjectType.RECORD */:
165165
return mergeRecords(values, utils, meta);
166-
case 2 /* ARRAY */:
166+
case 2 /* ObjectType.ARRAY */:
167167
return mergeArrays(values, utils, meta);
168-
case 3 /* SET */:
168+
case 3 /* ObjectType.SET */:
169169
return mergeSets(values, utils, meta);
170-
case 4 /* MAP */:
170+
case 4 /* ObjectType.MAP */:
171171
return mergeMaps(values, utils, meta);
172172
default:
173173
return mergeOthers(values, utils, meta);
@@ -266,7 +266,9 @@ function defaultMergeRecords(values, utils, meta) {
266266
propValues.push(value[key]);
267267
}
268268
}
269-
// assert(propValues.length > 0);
269+
if (propValues.length === 0) {
270+
continue;
271+
}
270272
const updatedMeta = utils.metaDataUpdater(meta, {
271273
key,
272274
parents: values,

dist/node/index.mjs

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,21 @@ import { isPlainObject } from 'is-plain-object';
88
*/
99
function getObjectType(object) {
1010
if (typeof object !== "object" || object === null) {
11-
return 0 /* NOT */;
11+
return 0 /* ObjectType.NOT */;
1212
}
1313
if (Array.isArray(object)) {
14-
return 2 /* ARRAY */;
14+
return 2 /* ObjectType.ARRAY */;
1515
}
1616
if (isPlainObject(object)) {
17-
return 1 /* RECORD */;
17+
return 1 /* ObjectType.RECORD */;
1818
}
1919
if (object instanceof Set) {
20-
return 3 /* SET */;
20+
return 3 /* ObjectType.SET */;
2121
}
2222
if (object instanceof Map) {
23-
return 4 /* MAP */;
23+
return 4 /* ObjectType.MAP */;
2424
}
25-
return 5 /* OTHER */;
25+
return 5 /* ObjectType.OTHER */;
2626
}
2727
/**
2828
* Get the keys of the given objects including symbol keys.
@@ -147,23 +147,23 @@ function mergeUnknowns(values, utils, meta) {
147147
}
148148
const type = getObjectType(values[0]);
149149
// eslint-disable-next-line functional/no-conditional-statement -- add an early escape for better performance.
150-
if (type !== 0 /* NOT */ && type !== 5 /* OTHER */) {
150+
if (type !== 0 /* ObjectType.NOT */ && type !== 5 /* ObjectType.OTHER */) {
151151
// eslint-disable-next-line functional/no-loop-statement -- using a loop here is more performant than mapping every value and then testing every value.
152-
for (let mutableIndex = 1; mutableIndex < values.length; mutableIndex++) {
153-
if (getObjectType(values[mutableIndex]) === type) {
152+
for (let m_index = 1; m_index < values.length; m_index++) {
153+
if (getObjectType(values[m_index]) === type) {
154154
continue;
155155
}
156156
return mergeOthers(values, utils, meta);
157157
}
158158
}
159159
switch (type) {
160-
case 1 /* RECORD */:
160+
case 1 /* ObjectType.RECORD */:
161161
return mergeRecords(values, utils, meta);
162-
case 2 /* ARRAY */:
162+
case 2 /* ObjectType.ARRAY */:
163163
return mergeArrays(values, utils, meta);
164-
case 3 /* SET */:
164+
case 3 /* ObjectType.SET */:
165165
return mergeSets(values, utils, meta);
166-
case 4 /* MAP */:
166+
case 4 /* ObjectType.MAP */:
167167
return mergeMaps(values, utils, meta);
168168
default:
169169
return mergeOthers(values, utils, meta);
@@ -262,7 +262,9 @@ function defaultMergeRecords(values, utils, meta) {
262262
propValues.push(value[key]);
263263
}
264264
}
265-
// assert(propValues.length > 0);
265+
if (propValues.length === 0) {
266+
continue;
267+
}
266268
const updatedMeta = utils.metaDataUpdater(meta, {
267269
key,
268270
parents: values,

0 commit comments

Comments
 (0)