Skip to content

add findLastIndex and inRange utility functions to fast-web-utilities #5528

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

Merged
merged 6 commits into from
Jan 24, 2022

Conversation

radium-v
Copy link
Collaborator

Pull Request

📖 Description

  • Adds a findLastIndex function to @microsoft/fast-web-utilities, which returns the index of the last item in an array which causes a predicate function to return true. Otherwise, it returns false. This is a simplified inversion of the built-in Array.prototype.findIndex function.
  • Adds a inRange function to @microsoft/fast-web-utilities, which returns true or false depending on if the value is within the range of the min and max. If max is not provided, the range is between min and 0 (min and max are sorted by value before the test is executed). This is a simplified adaptation of Lodash's _.inRange function.

👩‍💻 Reviewer Notes

These utility functions are needed for the upcoming listbox multiselect features.

📑 Test Plan

All tests should pass. inRange and findLastIndex will be used in an upcoming pull request.

✅ Checklist

General

  • I have included a change request file using $ yarn change
  • I have added tests for my changes.
  • I have tested my changes.
  • I have updated the project documentation to reflect my changes.
  • I have read the CONTRIBUTING documentation and followed the standards for this project.

@radium-v radium-v self-assigned this Jan 19, 2022
@radium-v radium-v force-pushed the users/jokreitl/utilities-findLastIndex branch from 365f875 to ca166e1 Compare January 19, 2022 19:22
@github-actions
Copy link

Azure Static Web Apps: Your stage site is ready! Visit it here: https://purple-ocean-0b7ce3410-5528.centralus.azurestaticapps.net

1 similar comment
@github-actions
Copy link

Azure Static Web Apps: Your stage site is ready! Visit it here: https://purple-ocean-0b7ce3410-5528.centralus.azurestaticapps.net

@github-actions
Copy link

Azure Static Web Apps: Your stage site is ready! Visit it here: https://purple-ocean-0b7ce3410-5528.centralus.azurestaticapps.net

3 similar comments
@github-actions
Copy link

Azure Static Web Apps: Your stage site is ready! Visit it here: https://purple-ocean-0b7ce3410-5528.centralus.azurestaticapps.net

@github-actions
Copy link

Azure Static Web Apps: Your stage site is ready! Visit it here: https://purple-ocean-0b7ce3410-5528.centralus.azurestaticapps.net

@github-actions
Copy link

Azure Static Web Apps: Your stage site is ready! Visit it here: https://purple-ocean-0b7ce3410-5528.centralus.azurestaticapps.net

@github-actions
Copy link

Azure Static Web Apps: Your stage site is ready! Visit it here: https://purple-ocean-0b7ce3410-5528.centralus.azurestaticapps.net

1 similar comment
@github-actions
Copy link

Azure Static Web Apps: Your stage site is ready! Visit it here: https://purple-ocean-0b7ce3410-5528.centralus.azurestaticapps.net

@radium-v radium-v force-pushed the users/jokreitl/utilities-findLastIndex branch from 7158ee9 to 06c2b32 Compare January 22, 2022 01:14
@github-actions
Copy link

Azure Static Web Apps: Your stage site is ready! Visit it here: https://purple-ocean-0b7ce3410-5528.centralus.azurestaticapps.net

TS environments with strictNullChecks will throw errors if these parameters are optional.
@github-actions
Copy link

Azure Static Web Apps: Your stage site is ready! Visit it here: https://purple-ocean-0b7ce3410-5528.centralus.azurestaticapps.net

2 similar comments
@github-actions
Copy link

Azure Static Web Apps: Your stage site is ready! Visit it here: https://purple-ocean-0b7ce3410-5528.centralus.azurestaticapps.net

@github-actions
Copy link

Azure Static Web Apps: Your stage site is ready! Visit it here: https://purple-ocean-0b7ce3410-5528.centralus.azurestaticapps.net

@github-actions
Copy link

Azure Static Web Apps: Your stage site is ready! Visit it here: https://purple-ocean-0b7ce3410-5528.centralus.azurestaticapps.net

@radium-v radium-v merged commit 97f653f into master Jan 24, 2022
@radium-v radium-v deleted the users/jokreitl/utilities-findLastIndex branch January 24, 2022 21:11
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.

5 participants