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 $nth operator to questDk #71

Merged
merged 18 commits into from
Feb 7, 2024
Merged

feat: add $nth operator to questDk #71

merged 18 commits into from
Feb 7, 2024

Conversation

mmackz
Copy link
Contributor

@mmackz mmackz commented Jan 26, 2024

This PR adds a $nth array operator which can be used to target specific items inside an array of parameters. It complements the $first, $last, and $some operators.

Tests were added to ensure the correct functionality of the $nth operator under various scenarios. These include validating that the operator correctly identifies the nth item in an array and that it will correctly handle when n exceeds the array length.

@mmackz mmackz requested a review from a team as a code owner January 26, 2024 04:05
Copy link

changeset-bot bot commented Jan 26, 2024

🦋 Changeset detected

Latest commit: 063813c

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@mmackz
Copy link
Contributor Author

mmackz commented Jan 26, 2024

Forgot to add type here

export type ArrayOperator =

Will add this asap

@@ -10,6 +10,12 @@ export type ArrayOperator =
| {
$last?: FilterOperator
}
| {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is this right?

Copy link
Member

Choose a reason for hiding this comment

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

Looks right I just cleaned it up into it's own type

Copy link
Contributor

github-actions bot commented Feb 6, 2024

Size Change: +198 B (+1%)

Total Size: 23.5 kB

Filename Size Change
dist/cjs/filter/filters.js 1.78 kB +66 B (+4%)
dist/esm/filter/filters.js 2.25 kB +132 B (+6%) 🔍
ℹ️ View Unchanged
Filename Size
dist/cjs/abi/erc20-quest.js 1.13 kB
dist/cjs/abi/erc20.js 578 B
dist/cjs/abi/quest-factory.js 2.08 kB
dist/cjs/actions/index.js 231 B
dist/cjs/actions/types.js 345 B
dist/cjs/constants.js 342 B
dist/cjs/errors/base.js 734 B
dist/cjs/errors/plugin.js 229 B
dist/cjs/errors/quest.js 331 B
dist/cjs/errors/utils.js 257 B
dist/cjs/errors/version.js 157 B
dist/cjs/filter/index.js 308 B
dist/cjs/filter/operators.js 268 B
dist/cjs/filter/types.js 124 B
dist/cjs/index.js 641 B
dist/cjs/quests/approveIfNeeded.js 525 B
dist/cjs/quests/constants.js 295 B
dist/cjs/quests/deployQuest.js 573 B
dist/cjs/quests/index.js 356 B
dist/cjs/quests/types.js 124 B
dist/cjs/utils/chains.js 375 B
dist/cjs/utils/compressJson.js 255 B
dist/cjs/utils/index.js 280 B
dist/esm/abi/erc20-quest.js 1.07 kB
dist/esm/abi/erc20.js 522 B
dist/esm/abi/quest-factory.js 2.02 kB
dist/esm/actions/index.js 100 B
dist/esm/actions/types.js 286 B
dist/esm/constants.js 303 B
dist/esm/errors/base.js 678 B
dist/esm/errors/plugin.js 158 B
dist/esm/errors/quest.js 276 B
dist/esm/errors/utils.js 164 B
dist/esm/errors/version.js 91 B
dist/esm/filter/index.js 135 B
dist/esm/filter/operators.js 162 B
dist/esm/filter/types.js 64 B
dist/esm/index.js 323 B
dist/esm/quests/approveIfNeeded.js 688 B
dist/esm/quests/constants.js 310 B
dist/esm/quests/deployQuest.js 494 B
dist/esm/quests/index.js 175 B
dist/esm/quests/types.js 64 B
dist/esm/utils/chains.js 448 B
dist/esm/utils/compressJson.js 279 B
dist/esm/utils/index.js 133 B

compressed-size-action

Quazia
Quazia previously approved these changes Feb 6, 2024
Copy link
Member

@Quazia Quazia left a comment

Choose a reason for hiding this comment

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

LGTM - I fixed the build and tweaked the types a little but this is good to go once you look over my changes.

@@ -10,6 +10,12 @@ export type ArrayOperator =
| {
$last?: FilterOperator
}
| {
Copy link
Member

Choose a reason for hiding this comment

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

Looks right I just cleaned it up into it's own type

@mmackz mmackz merged commit c2f1a76 into main Feb 7, 2024
10 checks passed
@mmackz mmackz deleted the mmackz-add-$nth-operator branch February 7, 2024 03:04
@github-actions github-actions bot mentioned this pull request Feb 7, 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.

2 participants