fix: remove extra idx and change map/any into some
This commit is contained in:
parent
1f94d95989
commit
4271d95a66
2 changed files with 1 additions and 7 deletions
|
|
@ -31,7 +31,6 @@ const Sidebar = ({
|
||||||
className={classes.linkWrapper}
|
className={classes.linkWrapper}
|
||||||
onClick={() => onClick(it)}>
|
onClick={() => onClick(it)}>
|
||||||
<div
|
<div
|
||||||
key={idx}
|
|
||||||
className={classnames({
|
className={classnames({
|
||||||
[classes.activeLink]: isSelected(it),
|
[classes.activeLink]: isSelected(it),
|
||||||
[classes.customRenderActiveLink]: itemRender && isSelected(it),
|
[classes.customRenderActiveLink]: itemRender && isSelected(it),
|
||||||
|
|
|
||||||
|
|
@ -39,12 +39,7 @@ const getValidationSchema = countryCodes =>
|
||||||
.required('A phone number is required')
|
.required('A phone number is required')
|
||||||
.test('is-valid-number', 'That is not a valid phone number', value => {
|
.test('is-valid-number', 'That is not a valid phone number', value => {
|
||||||
try {
|
try {
|
||||||
const validMap = R.map(it => {
|
return countryCodes.some(countryCode => parsePhoneNumberWithError(value, countryCode).isValid())
|
||||||
const number = parsePhoneNumberWithError(value, it)
|
|
||||||
return number.isValid()
|
|
||||||
}, countryCodes)
|
|
||||||
|
|
||||||
return R.any(it => it === true, validMap)
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue