Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
onClick={handleSubmit(data => {
let updatedData;
if (data.forward === true && data.strand !== 1) {
updatedData = { ...data, strand: 1 };
} else if (data.forward === false && data.strand !== -1) {
updatedData = { ...data, strand: -1 };
} else {
updatedData = data;
}
const hasJoinedLocations =
updatedData.locations && updatedData.locations.length > 1;
const newFeat = tidyUpAnnotation(
convertRangeTo0Based({
...updatedData,
...(annotationTypePlural === "primers" //if we're making a primer it should automatically have a type of primer
? { type: "primer" }
: {}),
locations: undefined, //by default clear locations
...(hasJoinedLocations && {
//only add locations if there are locations
start: updatedData.locations[0].start, //override the start and end to use the start and end of the joined locations
end:
updatedData.locations[updatedData.locations.length - 1]
.end,
locations: updatedData.locations.map(convertRangeTo0Based)
})
}),
{
onClick={handleSubmit(data => {
let updatedData;
if (data.forward === true && data.strand !== 1) {
updatedData = { ...data, strand: 1 };
} else if (data.forward === false && data.strand !== -1) {
updatedData = { ...data, strand: -1 };
} else {
updatedData = data;
}
const hasJoinedLocations =
updatedData.locations && updatedData.locations.length > 1;
const newFeat = tidyUpAnnotation(
convertRangeTo0Based({
...updatedData,
locations: undefined, //by default clear locations
...(hasJoinedLocations && {
//only add locations if there are locations
start: updatedData.locations[0].start, //override the start and end to use the start and end of the joined locations
end:
updatedData.locations[updatedData.locations.length - 1]
.end,
locations: updatedData.locations.map(convertRangeTo0Based)
})
}),
{
sequenceData,
annotationType: "features"
}