-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: make redirects via the input component case-insensitive (#879)
Revert "Revert "feat: make redirects via the input component case-insensitive" (#877)" This reverts commit f2279a4. Take 2 of #875. DAU-249
- Loading branch information
Showing
7 changed files
with
91 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
'@sajari/react-search-ui': major | ||
'sajari-sdk-docs': patch | ||
--- | ||
|
||
feat: make redirects via the input component case-insensitive | ||
|
||
Note: This update includes a breaking change to the way redirects work in the `@sajari/react-search-ui` `Input` component. The component no longer supports case-sensitive redirects. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { lowercaseObjectKeys } from '.'; | ||
|
||
test('lowercaseRedirects', () => { | ||
const redirects = { | ||
FoO: { id: '1', target: 'a' }, | ||
BAR: { id: '2', target: 'b' }, | ||
baz: { id: '3', target: 'c' }, | ||
test: { id: '4', target: 'd' }, | ||
Test: { id: '5', target: 'e' }, | ||
}; | ||
const want = { | ||
foo: { id: '1', target: 'a' }, | ||
bar: { id: '2', target: 'b' }, | ||
baz: { id: '3', target: 'c' }, | ||
test: { id: '5', target: 'e' }, | ||
}; | ||
|
||
const got = lowercaseObjectKeys(redirects); | ||
expect(got).toStrictEqual(want); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export function lowercaseObjectKeys(obj: object) { | ||
const newObj = {}; | ||
const keys = Object.keys(obj); | ||
for (let i = 0; i < keys.length; i++) { | ||
const key = keys[i]; | ||
newObj[key.toLowerCase()] = obj[key]; | ||
} | ||
return newObj; | ||
} |