Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(dset): Add merge function typing and add JSDoc documentation for dset and dset/merge #45

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

aidarkhanov
Copy link

Includes type definitions to handle deep merging of nested objects and overwriting arrays.

The types ensure that primitive values from the second argument (U) overwrite those in the first (T), while arrays are replaced entirely, not merged element-wise.

Example:

const obj1 = { a: { b: [1, 2] }, c: null, d: "jaja" };
const obj2 = { a: { b: [3, 4], c: [5, 6] } };

const result = merge(obj1, obj2);
// const result: {
//   a: {
//     c: number[];
//     b: number[];
//   };
//   c: null;
//   d: string;
// }

Also, adds JSDoc to the function type declarations for documentation.

Includes type definitions to handle deep merging of nested objects and overwriting arrays.

The types ensure that primitive values from the second argument (U) overwrite those in the first (T), while arrays are replaced entirely, not merged element-wise.

Example:

```typescript
const obj1 = { a: { b: [1, 2] }, c: null, d: "jaja" };
const obj2 = { a: { b: [3, 4], c: [5, 6] } };

const result = merge(obj1, obj2);
// const result: {
//   a: {
//     c: number[];
//     b: number[];
//   };
//   c: null;
//   d: string;
// }
```
@aidarkhanov aidarkhanov changed the title Add typing for merge docs(dset): Add merge function typing and add dlc Apr 3, 2024
@aidarkhanov aidarkhanov changed the title docs(dset): Add merge function typing and add dlc docs(dset): Add merge function typing and add JSDoc documentation for dset and dset/merge Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant