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

feat(core) Add beforeMapArray and afterMapArray configs #618

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

koenigstag
Copy link

@koenigstag koenigstag commented May 3, 2024

Description

For cases when we need to map an array of values - existing afterMap is not called for optimization purposes.

So I've decided to add new map configurations such as beforeMapArray and afterMapArray.

They are intended to work like beforeMap/afterMap configurations, but are executed only in mapArray and mutateArray methods.
These callbacks would receive an array of sources and array of destination objects, respectively.

Types

export type Mapping<
    TSource extends Dictionary<TSource> = any,
    TDestination extends Dictionary<TDestination> = any
> = [
  // ...
  callbacks?: [
      beforeMap?: MapCallback<TSource, TDestination>,
      afterMap?: MapCallback<TSource, TDestination>,
      beforeMapArray?: MapCallback<TSource[], TDestination[]>,
      afterMapArray?: MapCallback<TSource[], TDestination[]>,
  ],
  // ...
];

Checklist

  • Tests
  • Documentation

Copy link

sonarcloud bot commented May 4, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.9% Duplication on New Code

See analysis details on SonarCloud

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.

1 participant