-
Notifications
You must be signed in to change notification settings - Fork 531
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(connectToggleRefinement): add support for array values (#4420)
Co-authored-by: Haroen Viaene <fingebimus@me.com> Co-authored-by: Eunjae Lee <eunjae.lee@algolia.com> Co-authored-by: eunjae-lee <karis612@gmail.com>
- Loading branch information
1 parent
92bcc02
commit fe1fbee
Showing
6 changed files
with
165 additions
and
38 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
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,11 @@ | ||
import toArray from '../toArray'; | ||
|
||
describe('toArray', () => { | ||
test('cast to array if necessary', () => { | ||
expect(toArray).toBeInstanceOf(Function); | ||
expect(toArray('a')).toEqual(['a']); | ||
expect(toArray(['a'])).toEqual(['a']); | ||
// Checks that `toArray` acts like a function. | ||
expect(toArray.toString).toBe(Function.prototype.toString); | ||
}); | ||
}); |
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,5 @@ | ||
function toArray(value: any) { | ||
return Array.isArray(value) ? value : [value]; | ||
} | ||
|
||
export default toArray; |
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