Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
values.locations.forEach((loc, index) => {
// if (!isRangeWithinRange(loc, values, sequenceLength)) {
// errors.locations = errors.locations || {};
// errors.locations[index] = {
// start: "Range must fit within feature",
// end: "Range must fit within feature"
// };
// }
if (index !== 0 && index !== values.locations.length - 1) {
//it is a middle location so it should fit within the parent location
if (
!isRangeWithinRange(loc, entireLocationSpan, sequenceLength)
) {
errors.locations = errors.locations || {};
errors.locations[index] = {
start: "Joined spans must be in ascending order",
end: "Joined spans must be in ascending order"
};
}
}
values.locations.forEach((loc2, index2) => {
if (loc2 === loc) return;
if (checkIfPotentiallyCircularRangesOverlap(loc, loc2)) {
errors.locations = errors.locations || {};
errors.locations[index] = {
start: "Joined spans must not overlap",
end: "Joined spans must not overlap"
};
validate: (values, { sequenceLength }) => {
let errors = {};
if (
!isRangeWithinRange(
convertRangeTo0Based(values, sequenceLength),
{ start: 0, end: sequenceLength - 1 },
sequenceLength
)
) {
errors.start = "Range must fit within sequence";
errors.end = "Range must fit within sequence";
}
values.locations &&
values.locations.length > 1 &&
values.locations.forEach((loc, index) => {
// if (!isRangeWithinRange(loc, values, sequenceLength)) {
// errors.locations = errors.locations || {};
// errors.locations[index] = {
// start: "Range must fit within feature",
values.locations.forEach((loc, index) => {
// if (!isRangeWithinRange(loc, values, sequenceLength)) {
// errors.locations = errors.locations || {};
// errors.locations[index] = {
// start: "Range must fit within feature",
// end: "Range must fit within feature"
// };
// }
if (index !== 0 && index !== values.locations.length - 1) {
//it is a middle location so it should fit within the parent location
if (
!isRangeWithinRange(
loc,
{
start: values.locations[0].start,
end: values.locations[values.locations.length - 1].end
},
sequenceLength
)
) {
errors.locations = errors.locations || {};
errors.locations[index] = {
start: "Joined spans must be in ascending order",
end: "Joined spans must be in ascending order"
};
}
}
values.locations.forEach((loc2, index2) => {
validate: (values, { sequenceLength }) => {
let errors = {};
if (
!isRangeWithinRange(
convertRangeTo0Based(values, sequenceLength),
{ start: 0, end: sequenceLength - 1 },
sequenceLength
)
) {
errors.start = "Range must fit within sequence";
errors.end = "Range must fit within sequence";
return errors;
}
}
})
validate: (values, { sequenceLength, sequenceData }) => {
let errors = {};
const { circular } = sequenceData || {};
if (!circular && values.start > values.end) {
errors.start = "Start must be less than End for a linear sequence";
errors.end = "Start must be less than End for a linear sequence";
}
if (
!isRangeWithinRange(
convertRangeTo0Based(values, sequenceLength),
{ start: 0, end: sequenceLength - 1 },
sequenceLength
)
) {
errors.start = "Range must fit within sequence";
errors.end = "Range must fit within sequence";
}
if (values.locations && values.locations.length > 1) {
const entireLocationSpan = {
start: values.locations[0].start,
end: values.locations[values.locations.length - 1].end
};
if (entireLocationSpan.start > entireLocationSpan.end && !circular) {
errors.locations = errors.locations || {};
errors.locations[0] = {