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 array/base/cusome-by-right #2784

Merged
merged 28 commits into from
Sep 17, 2024

Conversation

GittyHarsha
Copy link
Contributor

Resolves #2330

Description

What is the purpose of this pull request?

This pull request:

Adds implementation for @stdlib/array/base/cusome-by-right

Related Issues

Does this pull request have any related issues?

This pull request:

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

No.

Checklist

Please ensure the following tasks are completed before submitting this pull request.


@stdlib-js/reviewers

Copy link
Contributor

@stdlib-bot stdlib-bot left a comment

Choose a reason for hiding this comment

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

👋 Hi there! 👋

And thank you for opening your first pull request! We will review it shortly. 🏃 💨

@GittyHarsha GittyHarsha marked this pull request as ready for review August 14, 2024 09:40
@GittyHarsha
Copy link
Contributor Author

GittyHarsha commented Aug 14, 2024

@kgryte, could you please review the PR.
Alongside I have a few doubts,

  1. In the packages present in @stdlib/array/base, the function present in main.js doesn't check for invalid input parameters.
    For example, in the package @stdlib/array/base/cuany main.js file, it doesn't check whether the input is a collection.

However in @stdlib/utils/some-by-right, the API checks for invalid parameters.

Should I also implement this check for @stdlib/array/base/cusome-by-right?
Here are the valid input parameters requirements for the API cusomeByRight( x, n, predicate[, thisArg] ).
x: array or an accessor array
n: positive integer
predicate: a function that returns a boolean value

@Planeshifter
Copy link
Member

@GittyHarsha We don't perform input validation in "base" implementations, so don't need to add such checks to this package. Thanks for asking!

Copy link
Member

@Planeshifter Planeshifter left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution, @GittyHarsha! This PR should be pretty close to be able to get merged. Left a few comments with mainly code style and documentation suggestions that should be applied.

@GittyHarsha
Copy link
Contributor Author

@Planeshifter, I made code changes to resolve the comments.

@kgryte kgryte removed the Ready To Merge A pull request which is ready to be merged. label Aug 14, 2024
Copy link
Member

@kgryte kgryte left a comment

Choose a reason for hiding this comment

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

This PR needs a fair amount of clean-up before it should be merged.

@kgryte kgryte added the Do Not Merge Pull request which should not be merged. label Aug 14, 2024
@kgryte
Copy link
Member

kgryte commented Aug 14, 2024

I've only done a partial review, but this PR needs a more careful review before it can move forward.

@GittyHarsha GittyHarsha marked this pull request as draft August 14, 2024 22:01
@kgryte kgryte added the Needs Changes Pull request which needs changes before being merged. label Aug 15, 2024
@GittyHarsha GittyHarsha marked this pull request as ready for review August 16, 2024 06:30
@GittyHarsha
Copy link
Contributor Author

GittyHarsha commented Aug 17, 2024

@kgryte and @Planeshifter,
Along with cleaning up the code, here are some notable changes I have made,

  1. Typescript assign interface member definition:

assign<T, U extends Collection | AccessorArrayLike<unknown>, V = unknown>( x: Collection<T> | AccessorArrayLike<T>, n: number, y: U, stride: number, offset: number, predicate: Predicate<T, V>, thisArg?: ThisParameterType<Predicate<T, V>> ): U;

Here, Unlike other similar packages in array/base #assign API, in this package the input and output array can have different primitive data types.
For example: the input array can be number[] and the output array of type (boolean | null)[].

in the definition,
the primitive data type for the input array is T
the output array is of type U where U extends Collection | AccessoryArrayLike<unknown>
and the this parameter of the predicate function is of type V

I request your comment on this
Thanks!

@Planeshifter Planeshifter changed the title feat: add @stdlib/array/base/cusome-by-right feat: add array/base/cusome-by-right Sep 8, 2024
@Planeshifter Planeshifter removed Do Not Merge Pull request which should not be merged. Needs Changes Pull request which needs changes before being merged. labels Sep 17, 2024
@Planeshifter Planeshifter merged commit 0bb460f into stdlib-js:develop Sep 17, 2024
10 checks passed
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.

[RFC]: add @stdlib/array/base/cusome-by-right
4 participants