-
-
Notifications
You must be signed in to change notification settings - Fork 610
Add IndexOf
, LastIndexOf
, IndicesOf
, CountOf
types
#1155
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
base: main
Are you sure you want to change the base?
Conversation
…se` types **External** - `IndexOf` Returns the index of the first occurrence of a value in an array, or -1 if it is not present. - `LastIndexOf` Returns the index of the last occurrence of a value in an array, or -1 if it is not present. - `AllIndexOf` Return an array of indexes of all the occurrences of a value in an array, or [] if it is not present. - `CountOf` Return the count of all the occurrences of a value in an array, or 0 if it is not present. - `ArrayReverse` Reverse an array.
@som-sm Hi, can u review this Please. Thanks ! |
Looks ok to me 👍 We cannot really review in detail without tests.
|
/** | ||
Simpler version of Sum<T, 1>, without the extra logic. | ||
*/ | ||
export type Increment<T extends number> = SumPositives<T, 1>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you exporting it? It's not used elsewhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ohh i forgot about it i was using it in a arithmetic types I'm working on to Improve Sum
, Substract
with a range of 10999 number, with also Multiplication, Division. do u consider adding does types or it just to much ?
…nexpose Increment type
@benzaria If you want to understand the feasibility of a type, please consider opening an issue first. Because without proper tests it doesn't really make sense to review the PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@benzaria A proper review would only be possible when tests are added. Also, every type needs proper documentation with examples.
Also, please submit one type per PR, unless the types are closely related. Once you start handling various edge cases, the implementations can become quite verbose and complex, so separating them into individual PRs makes a lot of sense. And even for simpler types, it's best to keep them in separate PRs whenever possible. |
IndexOf
, LastIndexOf
, AllIndexOf
, CountOf
and ArrayReverse
typesIndexOf
, LastIndexOf
, IndicesOf
, CountOf
and ArrayReverse
types
…litOnSpread for reversing arrays with spread element
IndexOf
, LastIndexOf
, IndicesOf
, CountOf
and ArrayReverse
typesIndexOf
, LastIndexOf
, IndicesOf
, CountOf
, Reverse
, SplitOnSpread
and ExtractStrict
types
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, please submit one type per PR, unless the types are closely related. Once you start handling various edge cases, the implementations can become quite verbose and complex, so separating them into individual PRs makes a lot of sense.
And even for simpler types, it's best to keep them in separate PRs whenever possible.
Doesn't make sense to add seven different types in one single PR. I'd rather prefer seven independent PRs.
Here’s what I’d suggest:
Pick one of the seven types, open a PR just for that, and get it reviewed and merged. Once you're familiar with the process and expectations, you can move on to opening PRs for the remaining types.
CC: @sindresorhus
@som-sm @sindresorhus Hey guys, I'm so sorry for the many types I made in this PRs. I know it's better to separate them in diff PRs. but when a type relies on the other it's not ideal take for example the Making a PRs for each individual type and wait to merge will take a lot of time, and will delay the contribution. the |
IndexOf
, LastIndexOf
, IndicesOf
, CountOf
, Reverse
, SplitOnSpread
and ExtractStrict
typesIndexOf
, LastIndexOf
, IndicesOf
, CountOf
types
Equivelent to
Array.prototype.[ indexOf | lastIndexOf ]
External
IndexOf
Returns the index of the first occurrence of a value in an array, or -1 if it is not present.LastIndexOf
Returns the index of the last occurrence of a value in an array, or -1 if it is not present.IndicesOf
Return an array of indexes of all the occurrences of a value in an array, or [] if it is not present.CountOf
Return the count of all the occurrences of a value in an array, or 0 if it is not present.Includes
Modified to useIndexOf