nexxtway/react-rainbow

View on GitHub
src/components/WeekDayPicker/helpers/valuePropValidation.js

Summary

Maintainability
A
35 mins
Test Coverage
import getWeekDays from './getWeekDays';

const weekDays = getWeekDays();

export default function valuePropValidation(propValue, key, componentName, location, propFullName) {
    if (!weekDays.some(day => day === propValue[key])) {
        return new Error(
            `Invalid prop ${propFullName} supplied to ${componentName} Validation failed.`,
        );
    }
    return null;
}