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: add optional matcher function for ArrayUnique decorator #830

Merged
merged 2 commits into from
Jan 11, 2021
Merged

feat: add optional matcher function for ArrayUnique decorator #830

merged 2 commits into from
Jan 11, 2021

Conversation

Diluka
Copy link
Contributor

@Diluka Diluka commented Dec 7, 2020

when identifer function supplied,
the comparison will base on the mapped array.

close #602

Description

Checklist

  • the pull request title describes what this PR does (not a vague title like Update index.md)
  • the pull request targets the default branch of the repository (develop)
  • the code follows the established code style of the repository
    • npm run prettier:check passes
    • npm run lint:check passes
  • tests are added for the changes I made (if any source code was modified)
  • documentation added or updated
  • I have run the project locally and verified that there are no errors

Fixes

fixes #[issue number], fixes #[issue number]

@Diluka Diluka changed the title feat(ArrayUnique): support identifer function feat: ArrayUnique support identifer function Dec 7, 2020
Diluka and others added 2 commits December 7, 2020 16:51
when identifer function supplied,
the comparison will base on the mapped array.

close #602
if (!(array instanceof Array)) return false;

if (identifier) {
array = array.map(o => (o != null ? identifier(o) : o));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you check for null here before calling the identifier function?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check null before calling or check null in every identifier function. I just pick the former

@NoNameProvided NoNameProvided changed the title feat: ArrayUnique support identifer function feat: add optional matcher function for ArrayUnique decorator Jan 11, 2021
@NoNameProvided NoNameProvided merged commit 90b3ae9 into typestack:develop Jan 11, 2021
@Diluka Diluka deleted the upgrade-array-unique branch January 12, 2021 01:34
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

ArrayClassUnique, or property-based uniqueness testing
2 participants