Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/polite-spies-happen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@js-utils-kit/types': minor
---

Add `PlainObject` type representing a generic JavaScript object with arbitrary property keys
43 changes: 43 additions & 0 deletions .changeset/solid-masks-spend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
'@js-utils-kit/object': minor
---

Add `deepMerge` utility for recursively merging objects with configurable array strategies (`replace`, `concat`, `merge`).

Deprecate `mergeObj` in favor of `deepMerge`.

#### Migration

```diff
- import { mergeObj } from "@js-utils-kit/object";
+ import { deepMerge } from "@js-utils-kit/object";

- const result = mergeObj(
- false,
- { a: 1 },
- { b: 2 }
- );
+ const result = deepMerge(
+ { a: 1 },
+ { b: 2 }
+ );

- mergeObj(
- true,
- { items: [1, 2] },
- { items: [3] }
- );
+ deepMerge(
+ { items: [1, 2] },
+ { items: [3] },
+ { arrayStrategy: "concat" }
+ );
```

```diff
- mergeObj(true, ...)
+ deepMerge(..., { arrayStrategy: "concat" })

- mergeObj(false, ...)
+ deepMerge(...)
```
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ js-utils-kit/
├── packages/ # All publishable/internal packages
├── scripts/ # Build & development tooling
├── eslint.config.ts # ESLint configuration
├── tsconfig.base.json # Base TypeScript config
├── tsconfig.json # TypeScript config
├── turbo.json # Turbo pipeline config
├── typedoc.json # Documentation config
├── pnpm-workspace.yaml # Workspace definition
Expand Down
2 changes: 1 addition & 1 deletion eslint.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default defineConfig([
languageOptions: {
parser: tsParser,
parserOptions: {
project: ['./tsconfig.base.json', './packages/**/*/tsconfig.json'],
project: ['./tsconfig.json', './packages/**/*/tsconfig.json'],
tsconfigRootDir: process.cwd(),
},
},
Expand Down
43 changes: 35 additions & 8 deletions exports.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"summary": {
"totalExports": 177,
"deprecatedExports": 0,
"totalExports": 180,
"deprecatedExports": 1,
"classExports": 0,
"functionExports": 79,
"functionExports": 80,
"variableExports": 81,
"typeExports": 16,
"valueExports": 160,
"typeExports": 18,
"valueExports": 161,
"totalPackages": 12
},
"exportNames": {
Expand Down Expand Up @@ -47,6 +47,7 @@
"randomFloat",
"randomInt",
"deepFreeze",
"deepMerge",
"mergeObj",
"detectPM",
"capitalize",
Expand Down Expand Up @@ -177,6 +178,7 @@
],
"typeExports": [
"SPDX",
"DeepMergeOptions",
"PackageManager",
"DetectPMOptions",
"DetectPMResult",
Expand All @@ -187,13 +189,14 @@
"HttpStatusCode",
"MinuteOrSecond",
"PackageJson",
"PlainObject",
"Trim",
"CommitScope",
"CommitType",
"CommitTypeMeta",
"DeepPartial"
],
"deprecatedExports": []
"deprecatedExports": ["mergeObj"]
},
"exports": {
"@js-utils-kit/array": [
Expand Down Expand Up @@ -986,12 +989,28 @@
"line": 99
},
{
"name": "mergeObj",
"name": "deepMerge",
"declarationKind": "FunctionDeclaration",
"exportKind": "function",
"deprecated": false,
"filePath": "packages/@js-utils-kit/object/src/deepMerge.ts",
"line": 91
},
{
"name": "DeepMergeOptions",
"declarationKind": "InterfaceDeclaration",
"exportKind": "type",
"deprecated": false,
"filePath": "packages/@js-utils-kit/object/src/deepMerge.ts",
"line": 7
},
{
"name": "mergeObj",
"declarationKind": "FunctionDeclaration",
"exportKind": "function",
"deprecated": true,
"filePath": "packages/@js-utils-kit/object/src/mergeObj.ts",
"line": 39
"line": 40
Comment thread
teneplaysofficial marked this conversation as resolved.
}
],
"@js-utils-kit/pm": [
Expand Down Expand Up @@ -1417,6 +1436,14 @@
"filePath": "packages/@js-utils-kit/types/src/PackageJson.ts",
"line": 56
},
{
"name": "PlainObject",
"declarationKind": "TypeAliasDeclaration",
"exportKind": "type",
"deprecated": false,
"filePath": "packages/@js-utils-kit/types/src/PlainObject.ts",
"line": 2
},
{
"name": "Trim",
"declarationKind": "InterfaceDeclaration",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"scripts": {
"prebuild": "rimraf --glob \"packages/**/dist\"",
"build": "turbo run build",
"build:docs": "typedoc --tsconfig tsconfig.base.json",
"build:docs": "typedoc",
"changeset": "changeset",
"checks": "node scripts/checks.js",
"fmt": "prettier --write .",
Expand Down
6 changes: 1 addition & 5 deletions packages/@js-utils-kit/array/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
{
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"composite": true,
"rootDir": "src"
},
"extends": "../../../tsconfig.json",
"include": ["src", "test"]
}
6 changes: 1 addition & 5 deletions packages/@js-utils-kit/charset/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
{
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"composite": true,
"rootDir": "src"
},
"extends": "../../../tsconfig.json",
"include": ["src", "test"]
}
6 changes: 1 addition & 5 deletions packages/@js-utils-kit/constants/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
{
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"composite": true,
"rootDir": "src"
},
"extends": "../../../tsconfig.json",
"include": ["src", "scripts"]
}
6 changes: 1 addition & 5 deletions packages/@js-utils-kit/core/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
{
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"composite": true,
"rootDir": "src"
},
"extends": "../../../tsconfig.json",
"include": ["src"]
}
6 changes: 1 addition & 5 deletions packages/@js-utils-kit/env/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
{
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"composite": true,
"rootDir": "src"
},
"extends": "../../../tsconfig.json",
"include": ["src", "test"]
}
6 changes: 1 addition & 5 deletions packages/@js-utils-kit/fs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
{
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"composite": true,
"rootDir": "src"
},
"extends": "../../../tsconfig.json",
"include": ["src", "test"]
}
6 changes: 1 addition & 5 deletions packages/@js-utils-kit/number/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
{
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"composite": true,
"rootDir": "src"
},
"extends": "../../../tsconfig.json",
"include": ["src", "test"]
}
5 changes: 4 additions & 1 deletion packages/@js-utils-kit/object/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,8 @@
"build": "tsdown",
"test": "vitest run"
},
"dependencies": {}
"dependencies": {
"@js-utils-kit/types": "workspace:*",
"@js-utils-kit/valid": "workspace:*"
}
}
Loading