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 Collection#subtract() #8393

Merged
merged 13 commits into from
Nov 19, 2022

Conversation

Syjalo
Copy link
Contributor

@Syjalo Syjalo commented Jul 29, 2022

Please describe the changes this PR makes and why it should be merged:

This PR adds a new method. The subtract method returns a new structure containing items where the keys and values of original structure are not present in the other.

Visualization

image

Status and versioning classification:

  • I know how to update typings and have done so, or typings don't need updating
  • This PR changes the library's interface (methods or parameters added)

@vercel
Copy link

vercel bot commented Jul 29, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Ignored Deployments
Name Status Preview Updated
discord-js ⬜️ Ignored (Inspect) Nov 19, 2022 at 9:27PM (UTC)
discord-js-guide ⬜️ Ignored (Inspect) Nov 19, 2022 at 9:27PM (UTC)

@vercel vercel bot temporarily deployed to Preview July 29, 2022 16:55 Inactive
@suneettipirneni
Copy link
Member

This should be called difference instead of missing since it aligns with the mathematical terminology.

@Jiralite
Copy link
Member

This should be called difference instead of missing since it aligns with the mathematical terminology.

Actually, that method seems to already exist.

@Syjalo
Copy link
Contributor Author

Syjalo commented Jul 29, 2022

This should be called difference instead of missing since it aligns with the mathematical terminology.

The difference method is exist and it's correct: see
Maybe name it as complement?: see

@suneettipirneni
Copy link
Member

This should be called difference instead of missing since it aligns with the mathematical terminology.

The difference method is exist and it's correct: see Maybe name it as complement?: see

The diagram in your PR description showed a difference operation, which made me think the function was implemented as a difference operation.

As for the naming technically it's a "relative complement" because there's no concept of a universal set in our context. That being said, "complement" would be better because the lack of a universal set is implied.

@1Computer1
Copy link
Contributor

The problem here is that the existing difference method should be symmetricDifference, while this should be difference. But relativeComplement or similar is also valid; missing doesn't mean much. Also possibly valid is minus or subtract, since that's common notation for the set difference.

@codecov
Copy link

codecov bot commented Jul 29, 2022

Codecov Report

Merging #8393 (6170c5f) into main (e74aa7f) will increase coverage by 0.02%.
The diff coverage is 100.00%.

❗ Current head 6170c5f differs from pull request most recent head 67eef90. Consider uploading reports for the commit 67eef90 to get more accurate results

@@            Coverage Diff             @@
##             main    #8393      +/-   ##
==========================================
+ Coverage   85.61%   85.63%   +0.02%     
==========================================
  Files          96       96              
  Lines        9459     9475      +16     
  Branches     1134     1137       +3     
==========================================
+ Hits         8098     8114      +16     
  Misses       1319     1319              
  Partials       42       42              
Flag Coverage Δ
brokers 65.24% <ø> (ø)
builders 98.65% <ø> (ø)
collection 100.00% <100.00%> (ø)
proxy 81.53% <ø> (ø)
rest 91.97% <ø> (ø)
util 100.00% <ø> (ø)
utilities 100.00% <ø> (ø)
voice 63.70% <ø> (ø)
ws 59.83% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
packages/collection/src/collection.ts 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@Syjalo Syjalo changed the title feat: add Collection#missing() feat: add Collection#complement() Jul 29, 2022
@vercel vercel bot temporarily deployed to Preview July 29, 2022 17:42 Inactive
@vercel vercel bot temporarily deployed to Preview July 29, 2022 18:27 Inactive
@vercel vercel bot temporarily deployed to Preview July 29, 2022 18:36 Inactive
@Syjalo Syjalo changed the title feat: add Collection#complement() feat: add Collection#subtract() Jul 30, 2022
@vercel vercel bot temporarily deployed to Preview July 30, 2022 05:43 Inactive
@vercel vercel bot temporarily deployed to Preview August 2, 2022 10:35 Inactive
kyranet
kyranet previously requested changes Aug 3, 2022
packages/collection/src/collection.ts Outdated Show resolved Hide resolved
@vercel vercel bot temporarily deployed to Preview August 4, 2022 07:37 Inactive
@vercel vercel bot temporarily deployed to Preview August 4, 2022 08:02 Inactive
@kodiakhq kodiakhq bot merged commit 291f36c into discordjs:main Nov 19, 2022
@Syjalo Syjalo deleted the add-Collection#missing() branch November 20, 2022 06:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet