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

allow for 404/page not found routing #76

Open
gforti opened this issue Mar 14, 2022 · 1 comment
Open

allow for 404/page not found routing #76

gforti opened this issue Mar 14, 2022 · 1 comment
Labels
enhancement New feature or request Services Mettle Library

Comments

@gforti
Copy link
Collaborator

gforti commented Mar 14, 2022

Description

AS A Developer,
I WANT to be able to send bad routes to a 404 page
SO THAT I CAN/MAY inform the user that the page link is no longer found

Acceptance Criteria

Scenario 1: Some determinable business situation
Given i am on a site
And the page not found route is configured
When a user navigates to a non existing page
Then a custom 404 page not found route is executed

Scenario 2: Some determinable business situation
Given i am on a site
and the page not found route is not configured
When a user navigates to a non existing page
Then the default behavior of loading the default page is executed

SCOPE CLARIFICATION

Adding the 404/not found route should not affect any default behavior

@gforti gforti added the enhancement New feature or request label Mar 14, 2022
@gforti gforti added the Services Mettle Library label Oct 26, 2022
@gforti
Copy link
Collaborator Author

gforti commented Apr 15, 2024

findObjRecursive(obj, findValue) {
    if ((typeof obj !== 'object' && !Array.isArray(obj)) || !obj) {
      return String(obj)?.trim()?.toLowerCase() === String(findValue)?.trim()?.toLowerCase() ? obj : Object.create(null)
    }
    const arrObj = typeof obj === 'object' ? Object.values(obj) : obj

    return arrObj.reduce((acc, value) => {
      if (typeof value === 'object' || Array.isArray(value)) {
        acc = { ...acc, ...this.findObjRecursive(value, findValue) }
      } else if (String(value)?.trim()?.toLowerCase() === String(findValue)?.trim()?.toLowerCase()) {
        acc = { ...acc, ...obj }
      }
      return acc
    }, Object.create(null))
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Services Mettle Library
Projects
None yet
Development

No branches or pull requests

1 participant