@teselagen/range-utils 0.3.14-beta.2 → 0.3.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/adjustRangeToDeletionOfAnotherRange.d.ts +1 -2
- package/adjustRangeToInsert.d.ts +1 -2
- package/adjustRangeToRotation.d.ts +1 -5
- package/checkIfNonCircularRangesOverlap.d.ts +1 -2
- package/checkIfPotentiallyCircularRangesOverlap.d.ts +1 -2
- package/collapseOverlapsGeneratedFromRangeComparisonIfPossible.d.ts +1 -2
- package/convertRangeIndices.d.ts +1 -10
- package/convertRangeTo0Based.d.ts +1 -5
- package/convertRangeTo1Based.d.ts +1 -5
- package/doesRangeSpanEntireSequence.d.ts +1 -2
- package/doesRangeSpanOrigin.d.ts +1 -2
- package/expandOrContractCircularRangeToPosition.d.ts +2 -3
- package/expandOrContractNonCircularRangeToPosition.d.ts +2 -3
- package/expandOrContractRangeByLength.d.ts +1 -5
- package/expandOrContractRangeToPosition.d.ts +2 -3
- package/flipContainedRange.d.ts +1 -5
- package/generateRandomRange.d.ts +3 -3
- package/getAnnotationRangeType.d.ts +1 -2
- package/getEachPositionInRangeAsArray.d.ts +1 -2
- package/getLengthOfOverlappingRegionsBetweenTwoRanges.d.ts +1 -2
- package/getMiddleOfRange.d.ts +1 -2
- package/getOverlapOfNonCircularRanges.d.ts +4 -5
- package/getOverlapsOfPotentiallyCircularRanges.d.ts +1 -2
- package/getPositionFromAngle.d.ts +1 -1
- package/getRangeAngles.d.ts +7 -3
- package/getRangeLength.d.ts +1 -5
- package/getRangesBetweenTwoRanges.d.ts +1 -2
- package/getSequenceWithinRange.d.ts +1 -2
- package/getShortestDistanceBetweenTwoPositions.d.ts +1 -1
- package/getYOffsetForPotentiallyCircularRange.d.ts +1 -2
- package/getYOffsetsForPotentiallyCircularRanges.d.ts +2 -3
- package/getZeroedRangeOverlaps.d.ts +1 -2
- package/index.cjs +41 -52
- package/index.d.ts +0 -1
- package/index.js +41 -52
- package/index.umd.cjs +41 -52
- package/invertRange.d.ts +1 -5
- package/isPositionCloserToRangeStartThanRangeEnd.d.ts +1 -2
- package/isPositionWithinRange.d.ts +2 -3
- package/isRangeOrPositionWithinRange.d.ts +1 -2
- package/isRangeWithinRange.d.ts +1 -2
- package/loopEachPositionInRange.d.ts +1 -2
- package/modulatePositionByRange.d.ts +1 -2
- package/modulateRangeBySequenceLength.d.ts +1 -8
- package/normalizePositionByRangeLength.d.ts +1 -1
- package/normalizePositionByRangeLength1Based.d.ts +1 -1
- package/normalizeRange.d.ts +1 -5
- package/package.json +4 -12
- package/provideInclusiveOptions.d.ts +1 -6
- package/reversePositionInRange.d.ts +1 -1
- package/splitRangeIntoTwoPartsIfItIsCircular.d.ts +3 -4
- package/translateRange.d.ts +1 -5
- package/trimAnnStartEndToFitSeqLength.d.ts +1 -1
- package/trimNonCicularRangeByAnotherNonCircularRange.d.ts +4 -2
- package/trimNumberToFitWithin0ToAnotherNumber.d.ts +1 -1
- package/trimRangeByAnotherRange.d.ts +1 -2
- package/zeroSubrangeByContainerRange.d.ts +1 -2
- package/RangeAngles.d.ts +0 -7
- package/src/RangeAngles.ts +0 -9
- package/src/adjustRangeToDeletionOfAnotherRange.ts +0 -57
- package/src/adjustRangeToInsert.ts +0 -32
- package/src/adjustRangeToRotation.ts +0 -23
- package/src/checkIfNonCircularRangesOverlap.ts +0 -35
- package/src/checkIfPotentiallyCircularRangesOverlap.ts +0 -28
- package/src/collapseOverlapsGeneratedFromRangeComparisonIfPossible.ts +0 -81
- package/src/convertRangeIndices.ts +0 -34
- package/src/convertRangeTo0Based.ts +0 -9
- package/src/convertRangeTo1Based.ts +0 -10
- package/src/doesRangeSpanEntireSequence.ts +0 -12
- package/src/doesRangeSpanOrigin.ts +0 -5
- package/src/expandOrContractCircularRangeToPosition.ts +0 -50
- package/src/expandOrContractNonCircularRangeToPosition.ts +0 -30
- package/src/expandOrContractRangeByLength.ts +0 -18
- package/src/expandOrContractRangeToPosition.ts +0 -16
- package/src/flipContainedRange.ts +0 -156
- package/src/generateRandomRange.ts +0 -26
- package/src/getAnnotationRangeType.ts +0 -30
- package/src/getEachPositionInRangeAsArray.ts +0 -19
- package/src/getLengthOfOverlappingRegionsBetweenTwoRanges.ts +0 -18
- package/src/getMiddleOfRange.ts +0 -11
- package/src/getOverlapOfNonCircularRanges.ts +0 -41
- package/src/getOverlapsOfPotentiallyCircularRanges.ts +0 -60
- package/src/getPositionFromAngle.ts +0 -12
- package/src/getRangeAngles.ts +0 -38
- package/src/getRangeLength.test.ts +0 -30
- package/src/getRangeLength.ts +0 -17
- package/src/getRangesBetweenTwoRanges.ts +0 -42
- package/src/getSequenceWithinRange.test.ts +0 -47
- package/src/getSequenceWithinRange.ts +0 -24
- package/src/getShortestDistanceBetweenTwoPositions.test.ts +0 -12
- package/src/getShortestDistanceBetweenTwoPositions.ts +0 -16
- package/src/getYOffsetForPotentiallyCircularRange.ts +0 -37
- package/src/getYOffsetsForPotentiallyCircularRanges.test.ts +0 -17
- package/src/getYOffsetsForPotentiallyCircularRanges.ts +0 -28
- package/src/getZeroedRangeOverlaps.test.ts +0 -65
- package/src/getZeroedRangeOverlaps.ts +0 -33
- package/src/index.test.ts +0 -39
- package/src/index.ts +0 -53
- package/src/invertRange.ts +0 -25
- package/src/isPositionCloserToRangeStartThanRangeEnd.ts +0 -22
- package/src/isPositionWithinRange.ts +0 -40
- package/src/isRangeOrPositionWithinRange.ts +0 -40
- package/src/isRangeWithinRange.ts +0 -18
- package/src/loopEachPositionInRange.ts +0 -11
- package/src/modulatePositionByRange.ts +0 -15
- package/src/modulateRangeBySequenceLength.ts +0 -13
- package/src/normalizePositionByRangeLength.ts +0 -24
- package/src/normalizePositionByRangeLength1Based.ts +0 -9
- package/src/normalizeRange.ts +0 -12
- package/src/provideInclusiveOptions.ts +0 -79
- package/src/reversePositionInRange.ts +0 -17
- package/src/splitRangeIntoTwoPartsIfItIsCircular.ts +0 -36
- package/src/translateRange.ts +0 -21
- package/src/trimAnnStartEndToFitSeqLength.ts +0 -9
- package/src/trimNonCicularRangeByAnotherNonCircularRange.ts +0 -63
- package/src/trimNumberToFitWithin0ToAnotherNumber.ts +0 -15
- package/src/trimRangeByAnotherRange.ts +0 -103
- package/src/types.ts +0 -12
- package/src/zeroSubrangeByContainerRange.ts +0 -49
- package/types.d.ts +0 -12
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default function adjustRangeToDeletionOfAnotherRange(rangeToBeAdjusted: Range, anotherRange: Range, maxLength: number): Range | null;
|
|
1
|
+
export default function adjustRangeToDeletionOfAnotherRange(rangeToBeAdjusted: any, anotherRange: any, maxLength: any): object | null;
|
package/adjustRangeToInsert.d.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default function adjustRangeToInsert(rangeToBeAdjusted: Range, insertStart: number, insertLength: number): Range;
|
|
1
|
+
export default function adjustRangeToInsert(rangeToBeAdjusted: any, insertStart: any, insertLength: any): any;
|
|
@@ -1,5 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default function adjustRangeToRotation(rangeToBeAdjusted: Range, rotateTo?: number, rangeLength?: number): Range & {
|
|
3
|
-
start: number;
|
|
4
|
-
end: number;
|
|
5
|
-
};
|
|
1
|
+
export default function adjustRangeToRotation(rangeToBeAdjusted: any, rotateTo: number | undefined, rangeLength: any): any;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default function checkIfNonCircularRangesOverlap(range: Range, comparisonRange: Range): boolean;
|
|
1
|
+
export default function checkIfNonCircularRangesOverlap(range: any, comparisonRange: any): boolean;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default function checkIfPotentiallyCircularRangesOverlap(range: Range, comparisonRange: Range): boolean;
|
|
1
|
+
export default function checkIfPotentiallyCircularRangesOverlap(range: any, comparisonRange: any): boolean;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default function collapseOverlapsGeneratedFromRangeComparisonIfPossible(overlaps: Range[], sequenceLength: number, optionalOriginalRange?: Range): Range[];
|
|
1
|
+
export default function collapseOverlapsGeneratedFromRangeComparisonIfPossible(overlaps: any, sequenceLength: any, optionalOriginalRange: any): any;
|
package/convertRangeIndices.d.ts
CHANGED
|
@@ -1,10 +1 @@
|
|
|
1
|
-
|
|
2
|
-
interface RangeIndicesOptions {
|
|
3
|
-
inclusive1BasedStart?: boolean;
|
|
4
|
-
inclusive1BasedEnd?: boolean;
|
|
5
|
-
}
|
|
6
|
-
export default function convertRangeIndices(range: Range, inputType?: RangeIndicesOptions, outputType?: RangeIndicesOptions): Range & {
|
|
7
|
-
start: number;
|
|
8
|
-
end: number;
|
|
9
|
-
};
|
|
10
|
-
export {};
|
|
1
|
+
export default function convertRangeIndices(range: any, inputType: any, outputType: any): any;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default function doesRangeSpanEntireSequence(range: Range, sequenceLength: number): boolean;
|
|
1
|
+
export default function doesRangeSpanEntireSequence(range: any, sequenceLength: any): true | undefined;
|
package/doesRangeSpanOrigin.d.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default function doesRangeSpanOrigin(range: Range): boolean;
|
|
1
|
+
export default function doesRangeSpanOrigin(range: any): boolean;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
newRange: Range;
|
|
1
|
+
export default function expandOrContractCircularRangeToPosition(range: any, position: any, maxLength: any): {
|
|
2
|
+
newRange: any;
|
|
4
3
|
endMoved: boolean;
|
|
5
4
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
newRange: Range;
|
|
1
|
+
export default function expandOrContractNonCircularRangeToPosition(range: any, position: any): {
|
|
2
|
+
newRange: any;
|
|
4
3
|
endMoved: boolean;
|
|
5
4
|
};
|
|
@@ -1,5 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default function expandOrContractRangeByLength(range: Range, shiftBy: number, shiftStart: boolean, sequenceLength: number): Range & {
|
|
3
|
-
start: number;
|
|
4
|
-
end: number;
|
|
5
|
-
};
|
|
1
|
+
export default function expandOrContractRangeByLength(range: any, shiftBy: any, shiftStart: any, sequenceLength: any): any;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
newRange: Range;
|
|
1
|
+
export default function expandOrContractRangeToPosition(range: any, position: any, maxLength: any): {
|
|
2
|
+
newRange: any;
|
|
4
3
|
endMoved: boolean;
|
|
5
4
|
};
|
package/flipContainedRange.d.ts
CHANGED
|
@@ -1,5 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default function flipRelativeRange(innerRange: Range, outerRange: Range, sequenceLength: number): Range & {
|
|
3
|
-
start: number;
|
|
4
|
-
end: number;
|
|
5
|
-
};
|
|
1
|
+
export default function flipRelativeRange(innerRange: any, outerRange: any, sequenceLength: any): any;
|
package/generateRandomRange.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export default function generateRandomRange(minStart:
|
|
2
|
-
start:
|
|
3
|
-
end:
|
|
1
|
+
export default function generateRandomRange(minStart: any, maxEnd: any, maxLength: any): {
|
|
2
|
+
start: any;
|
|
3
|
+
end: any;
|
|
4
4
|
};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default function getAnnotationRangeType(annotationRange: Range, enclosingRangeType: Range, forward: boolean): "end" | "beginningAndEnd" | "start" | "middle";
|
|
1
|
+
export default function getAnnotationRangeType(annotationRange: any, enclosingRangeType: any, forward: any): "end" | "beginningAndEnd" | "start" | "middle";
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default function getEachPositionInRangeAsArray(range: Range, rangeMax: number): number[];
|
|
1
|
+
export default function getEachPositionInRangeAsArray(range: any, rangeMax: any): any[];
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default function getLengthOfOverlappingRegionsBetweenTwoRanges(rangeA: Range, rangeB: Range, maxLength: number): number;
|
|
1
|
+
export default function getLengthOfOverlappingRegionsBetweenTwoRanges(rangeA: any, rangeB: any, maxLength: any): any;
|
package/getMiddleOfRange.d.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default function getMiddleOfRange(range: Range, rangeMax: number): number;
|
|
1
|
+
export default function getMiddleOfRange(range: any, rangeMax: any): any;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
} | null;
|
|
1
|
+
export default function getOverlapOfNonCircularRanges(rangeA: any, rangeB: any): {
|
|
2
|
+
start: any;
|
|
3
|
+
end: any;
|
|
4
|
+
} | undefined;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default function getOverlapsOfPotentiallyCircularRanges(rangeA: Range, rangeB: Range, maxRangeLength: number, joinIfPossible?: boolean): Range[];
|
|
1
|
+
export default function getOverlapsOfPotentiallyCircularRanges(rangeA: any, rangeB: any, maxRangeLength: any, joinIfPossible: any): any[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function getPositionFromAngle(angle:
|
|
1
|
+
export default function getPositionFromAngle(angle: any, rangeMax: any, isInBetweenPositions: any): number;
|
package/getRangeAngles.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
export default function getRangeAngles(range: any, rangeMax: any): {
|
|
2
|
+
startAngle: number;
|
|
3
|
+
totalAngle: number;
|
|
4
|
+
endAngle: number;
|
|
5
|
+
centerAngle: number;
|
|
6
|
+
locationAngles: any;
|
|
7
|
+
};
|
package/getRangeLength.d.ts
CHANGED
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
declare const _default: (range: Range, rangeMax: number, options?: {
|
|
3
|
-
inclusive1BasedEnd?: boolean;
|
|
4
|
-
inclusive1BasedStart?: boolean;
|
|
5
|
-
} | undefined) => number;
|
|
1
|
+
declare const _default: (...args: any[]) => any;
|
|
6
2
|
export default _default;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default function getRangesBetweenTwoRanges(range1: Range, range2: Range): Range[];
|
|
1
|
+
export default function getRangesBetweenTwoRanges(range1: any, range2: any): any[];
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default function getSequenceWithinRange<T>(range: Range, sequence: string | T[]): string | T[];
|
|
1
|
+
export default function getSequenceWithinRange(range: any, sequence: any): any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function getShortestDistanceBetweenTwoPositions(position1:
|
|
1
|
+
export default function getShortestDistanceBetweenTwoPositions(position1: any, position2: any, sequenceLength: any): number;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default function getYOffsetForPotentiallyCircularRange(range: Range, YOffsetLevelsWithRanges: Range[][], assignYOffsetToRange: boolean): number;
|
|
1
|
+
export default function getYOffsetForPotentiallyCircularRange(range: any, YOffsetLevelsWithRanges: any, assignYOffsetToRange: any): any;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
yOffsets: number[];
|
|
1
|
+
export default function getYOffsetsForPotentiallyCircularRanges(ranges: any, assignYOffsetToRange: any): {
|
|
2
|
+
yOffsets: any[];
|
|
4
3
|
maxYOffset: number;
|
|
5
4
|
};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default function getZeroedRangeOverlaps(annotation: Range, selection: Range, sequenceLength: number): Range[];
|
|
1
|
+
export default function getZeroedRangeOverlaps(annotation: any, selection: any, sequenceLength: any): any;
|
package/index.cjs
CHANGED
|
@@ -1566,10 +1566,9 @@ function getOverlapOfNonCircularRanges(rangeA, rangeB) {
|
|
|
1566
1566
|
}
|
|
1567
1567
|
}
|
|
1568
1568
|
}
|
|
1569
|
-
return null;
|
|
1570
1569
|
}
|
|
1571
1570
|
__name(getOverlapOfNonCircularRanges, "getOverlapOfNonCircularRanges");
|
|
1572
|
-
function getOverlapsOfPotentiallyCircularRanges(rangeA, rangeB, maxRangeLength, joinIfPossible
|
|
1571
|
+
function getOverlapsOfPotentiallyCircularRanges(rangeA, rangeB, maxRangeLength, joinIfPossible) {
|
|
1573
1572
|
const normalizedRangeA = splitRangeIntoTwoPartsIfItIsCircular(
|
|
1574
1573
|
rangeA,
|
|
1575
1574
|
maxRangeLength
|
|
@@ -1600,11 +1599,8 @@ function getOverlapsOfPotentiallyCircularRanges(rangeA, rangeB, maxRangeLength,
|
|
|
1600
1599
|
joinedOverlap.start = o.start;
|
|
1601
1600
|
return [];
|
|
1602
1601
|
}
|
|
1603
|
-
return [o];
|
|
1604
1602
|
});
|
|
1605
|
-
|
|
1606
|
-
overlaps.push(joinedOverlap);
|
|
1607
|
-
}
|
|
1603
|
+
overlaps.push(joinedOverlap);
|
|
1608
1604
|
}
|
|
1609
1605
|
return overlaps;
|
|
1610
1606
|
}
|
|
@@ -1677,7 +1673,10 @@ function trimRangeByAnotherRange(rangeToBeTrimmed, trimmingRange, sequenceLength
|
|
|
1677
1673
|
if (!overlaps.length) {
|
|
1678
1674
|
return rangeToBeTrimmed;
|
|
1679
1675
|
}
|
|
1680
|
-
const splitRangesToBeTrimmed = splitRangeIntoTwoPartsIfItIsCircular(
|
|
1676
|
+
const splitRangesToBeTrimmed = splitRangeIntoTwoPartsIfItIsCircular(
|
|
1677
|
+
rangeToBeTrimmed,
|
|
1678
|
+
sequenceLength
|
|
1679
|
+
);
|
|
1681
1680
|
splitRangesToBeTrimmed.forEach(function(nonCircularRangeToBeTrimmed, index) {
|
|
1682
1681
|
overlaps.forEach(function(overlap) {
|
|
1683
1682
|
if (nonCircularRangeToBeTrimmed) {
|
|
@@ -1720,7 +1719,6 @@ function trimRangeByAnotherRange(rangeToBeTrimmed, trimmingRange, sequenceLength
|
|
|
1720
1719
|
end: outputTrimmedRange.end
|
|
1721
1720
|
});
|
|
1722
1721
|
}
|
|
1723
|
-
return void 0;
|
|
1724
1722
|
}
|
|
1725
1723
|
__name(trimRangeByAnotherRange, "trimRangeByAnotherRange");
|
|
1726
1724
|
function adjustRangeToDeletionOfAnotherRange(rangeToBeAdjusted, anotherRange, maxLength) {
|
|
@@ -1867,10 +1865,11 @@ function collapseOverlapsGeneratedFromRangeComparisonIfPossible(overlaps, sequen
|
|
|
1867
1865
|
}
|
|
1868
1866
|
}
|
|
1869
1867
|
}
|
|
1870
|
-
return overlaps;
|
|
1871
1868
|
}
|
|
1872
1869
|
__name(collapseOverlapsGeneratedFromRangeComparisonIfPossible, "collapseOverlapsGeneratedFromRangeComparisonIfPossible");
|
|
1873
|
-
function convertRangeIndices(range, inputType
|
|
1870
|
+
function convertRangeIndices(range, inputType, outputType) {
|
|
1871
|
+
inputType = inputType || {};
|
|
1872
|
+
outputType = outputType || {};
|
|
1874
1873
|
return assign({}, range, {
|
|
1875
1874
|
start: Number(range.start) + (inputType.inclusive1BasedStart ? outputType.inclusive1BasedStart ? 0 : -1 : outputType.inclusive1BasedStart ? 1 : 0),
|
|
1876
1875
|
end: Number(range.end) + (inputType.inclusive1BasedEnd ? outputType.inclusive1BasedEnd ? 0 : -1 : outputType.inclusive1BasedEnd ? 1 : 0)
|
|
@@ -1893,32 +1892,25 @@ function convertRangeTo1Based(range) {
|
|
|
1893
1892
|
}
|
|
1894
1893
|
__name(convertRangeTo1Based, "convertRangeTo1Based");
|
|
1895
1894
|
function provideInclusiveOptions(funToWrap) {
|
|
1896
|
-
return function(
|
|
1895
|
+
return function() {
|
|
1896
|
+
const args = Array.prototype.slice.call(arguments);
|
|
1897
1897
|
const options = args[args.length - 1];
|
|
1898
1898
|
if (options && (options.inclusive1BasedEnd || options.inclusive1BasedStart)) {
|
|
1899
1899
|
args.forEach(function(arg, index) {
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
args[index] = assign(potentialRange, {
|
|
1903
|
-
start: potentialRange.start - 1
|
|
1904
|
-
});
|
|
1900
|
+
if (arg && arg.start > -1 && options.inclusive1BasedStart) {
|
|
1901
|
+
args[index] = assign(arg, { start: arg.start - 1 });
|
|
1905
1902
|
}
|
|
1906
|
-
if (
|
|
1907
|
-
args[index] = assign(
|
|
1908
|
-
end: potentialRange.end - 1
|
|
1909
|
-
});
|
|
1903
|
+
if (arg && arg.end > -1 && options.inclusive1BasedEnd) {
|
|
1904
|
+
args[index] = assign(arg, { end: arg.end - 1 });
|
|
1910
1905
|
}
|
|
1911
1906
|
});
|
|
1912
1907
|
}
|
|
1913
1908
|
let returnVal = funToWrap.apply(this, args);
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
returnVal = assign(potentialReturn, {
|
|
1917
|
-
start: potentialReturn.start + 1
|
|
1918
|
-
});
|
|
1909
|
+
if (returnVal && returnVal.start > -1 && options && options.inclusive1BasedStart) {
|
|
1910
|
+
returnVal = assign(returnVal, { start: returnVal.start + 1 });
|
|
1919
1911
|
}
|
|
1920
|
-
if (
|
|
1921
|
-
returnVal = assign(
|
|
1912
|
+
if (returnVal && returnVal.end > -1 && options && options.inclusive1BasedEnd) {
|
|
1913
|
+
returnVal = assign(returnVal, { end: returnVal.end + 1 });
|
|
1922
1914
|
}
|
|
1923
1915
|
return returnVal;
|
|
1924
1916
|
};
|
|
@@ -1939,10 +1931,9 @@ function getRangeLength$1(range, rangeMax) {
|
|
|
1939
1931
|
}
|
|
1940
1932
|
__name(getRangeLength$1, "getRangeLength$1");
|
|
1941
1933
|
function doesRangeSpanEntireSequence(range, sequenceLength) {
|
|
1942
|
-
if (getRangeLength(range
|
|
1934
|
+
if (getRangeLength(range) === sequenceLength) {
|
|
1943
1935
|
return true;
|
|
1944
1936
|
}
|
|
1945
|
-
return false;
|
|
1946
1937
|
}
|
|
1947
1938
|
__name(doesRangeSpanEntireSequence, "doesRangeSpanEntireSequence");
|
|
1948
1939
|
function isRangeWithinRange(rangeToCheck, containingRange, maxLength) {
|
|
@@ -1976,9 +1967,6 @@ function isRangeOrPositionWithinRange(rangeOrPositionToCheck, containingRange, m
|
|
|
1976
1967
|
return false;
|
|
1977
1968
|
}
|
|
1978
1969
|
if (isObject(rangeOrPositionToCheck)) {
|
|
1979
|
-
if (typeof rangeOrPositionToCheck.start !== "number") {
|
|
1980
|
-
return false;
|
|
1981
|
-
}
|
|
1982
1970
|
return isRangeWithinRange(
|
|
1983
1971
|
rangeOrPositionToCheck,
|
|
1984
1972
|
containingRange,
|
|
@@ -1999,7 +1987,7 @@ function doesRangeSpanOrigin(range) {
|
|
|
1999
1987
|
return range.start > range.end;
|
|
2000
1988
|
}
|
|
2001
1989
|
__name(doesRangeSpanOrigin, "doesRangeSpanOrigin");
|
|
2002
|
-
function normalizePositionByRangeLength(pPosition, sequenceLength, isInBetweenPositions
|
|
1990
|
+
function normalizePositionByRangeLength(pPosition, sequenceLength, isInBetweenPositions) {
|
|
2003
1991
|
let position = pPosition;
|
|
2004
1992
|
if (position < 0) {
|
|
2005
1993
|
position += sequenceLength;
|
|
@@ -2091,7 +2079,10 @@ function expandOrContractRangeToPosition(range, position, maxLength) {
|
|
|
2091
2079
|
if (range.start > range.end) {
|
|
2092
2080
|
return expandOrContractCircularRangeToPosition(range, position, maxLength);
|
|
2093
2081
|
} else {
|
|
2094
|
-
return expandOrContractNonCircularRangeToPosition(
|
|
2082
|
+
return expandOrContractNonCircularRangeToPosition(
|
|
2083
|
+
range,
|
|
2084
|
+
position
|
|
2085
|
+
);
|
|
2095
2086
|
}
|
|
2096
2087
|
}
|
|
2097
2088
|
__name(expandOrContractRangeToPosition, "expandOrContractRangeToPosition");
|
|
@@ -2355,9 +2346,7 @@ function getSequenceWithinRange(range, sequence) {
|
|
|
2355
2346
|
if (typeof subSequence === "string") {
|
|
2356
2347
|
subSequence += sequence.slice(0, range.end + 1);
|
|
2357
2348
|
} else {
|
|
2358
|
-
subSequence = subSequence.concat(
|
|
2359
|
-
sequence.slice(0, range.end + 1)
|
|
2360
|
-
);
|
|
2349
|
+
subSequence = subSequence.concat(sequence.slice(0, range.end + 1));
|
|
2361
2350
|
}
|
|
2362
2351
|
return subSequence;
|
|
2363
2352
|
} else {
|
|
@@ -2377,7 +2366,7 @@ function getShortestDistanceBetweenTwoPositions(position1, position2, sequenceLe
|
|
|
2377
2366
|
}
|
|
2378
2367
|
__name(getShortestDistanceBetweenTwoPositions, "getShortestDistanceBetweenTwoPositions");
|
|
2379
2368
|
function getYOffsetForPotentiallyCircularRange(range, YOffsetLevelsWithRanges, assignYOffsetToRange) {
|
|
2380
|
-
let yOffset =
|
|
2369
|
+
let yOffset = [];
|
|
2381
2370
|
const openYOffsetFound = YOffsetLevelsWithRanges.some(
|
|
2382
2371
|
function(rangesAlreadyAddedToYOffset, index) {
|
|
2383
2372
|
const rangeBlocked = rangesAlreadyAddedToYOffset.some(
|
|
@@ -2427,20 +2416,21 @@ function getYOffsetsForPotentiallyCircularRanges(ranges, assignYOffsetToRange) {
|
|
|
2427
2416
|
__name(getYOffsetsForPotentiallyCircularRanges, "getYOffsetsForPotentiallyCircularRanges");
|
|
2428
2417
|
const invertRange = provideInclusiveOptions(invertRange$1);
|
|
2429
2418
|
function invertRange$1(rangeOrCaret, rangeMax) {
|
|
2430
|
-
if (
|
|
2419
|
+
if (rangeOrCaret.start > -1) {
|
|
2431
2420
|
const start = rangeOrCaret.end + 1;
|
|
2432
2421
|
const end = rangeOrCaret.start - 1;
|
|
2433
2422
|
return {
|
|
2434
2423
|
start: normalizePositionByRangeLength(start, rangeMax, false),
|
|
2435
2424
|
end: normalizePositionByRangeLength(end, rangeMax, false)
|
|
2436
2425
|
};
|
|
2437
|
-
} else
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2426
|
+
} else {
|
|
2427
|
+
if (rangeOrCaret > -1) {
|
|
2428
|
+
return {
|
|
2429
|
+
start: normalizePositionByRangeLength(rangeOrCaret, rangeMax, false),
|
|
2430
|
+
end: normalizePositionByRangeLength(rangeOrCaret - 1, rangeMax, false)
|
|
2431
|
+
};
|
|
2432
|
+
}
|
|
2442
2433
|
}
|
|
2443
|
-
return void 0;
|
|
2444
2434
|
}
|
|
2445
2435
|
__name(invertRange$1, "invertRange$1");
|
|
2446
2436
|
function isPositionCloserToRangeStartThanRangeEnd(position, range, maxLength) {
|
|
@@ -2508,10 +2498,9 @@ function zeroSubrangeByContainerRange(subRange, containerRange, sequenceLength)
|
|
|
2508
2498
|
"subRange must be fully contained by containerRange! Otherwise this function does not make sense"
|
|
2509
2499
|
);
|
|
2510
2500
|
}
|
|
2511
|
-
const newSubrange = {
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
};
|
|
2501
|
+
const newSubrange = {};
|
|
2502
|
+
newSubrange.start = subRange.start - containerRange.start;
|
|
2503
|
+
newSubrange.end = subRange.end - containerRange.start;
|
|
2515
2504
|
if (newSubrange.start < 0) {
|
|
2516
2505
|
newSubrange.start += sequenceLength;
|
|
2517
2506
|
}
|
|
@@ -2522,10 +2511,10 @@ function zeroSubrangeByContainerRange(subRange, containerRange, sequenceLength)
|
|
|
2522
2511
|
}
|
|
2523
2512
|
__name(zeroSubrangeByContainerRange, "zeroSubrangeByContainerRange");
|
|
2524
2513
|
function adjustRangeToRotation(rangeToBeAdjusted, rotateTo = 0, rangeLength) {
|
|
2525
|
-
const mod =
|
|
2514
|
+
const mod = rangeLength ? modulo : identity;
|
|
2526
2515
|
const newRange = assign({}, rangeToBeAdjusted, {
|
|
2527
|
-
start: mod(rangeToBeAdjusted.start - (rotateTo || 0)),
|
|
2528
|
-
end: mod(rangeToBeAdjusted.end - (rotateTo || 0))
|
|
2516
|
+
start: mod(rangeToBeAdjusted.start - (rotateTo || 0), rangeLength),
|
|
2517
|
+
end: mod(rangeToBeAdjusted.end - (rotateTo || 0), rangeLength)
|
|
2529
2518
|
});
|
|
2530
2519
|
return newRange;
|
|
2531
2520
|
}
|
package/index.d.ts
CHANGED
|
@@ -50,4 +50,3 @@ export { default as zeroSubrangeByContainerRange } from './zeroSubrangeByContain
|
|
|
50
50
|
export { default as adjustRangeToRotation } from './adjustRangeToRotation';
|
|
51
51
|
export { default as getZeroedRangeOverlaps } from './getZeroedRangeOverlaps';
|
|
52
52
|
export { default as trimAnnStartEndToFitSeqLength } from './trimAnnStartEndToFitSeqLength';
|
|
53
|
-
export * from './types';
|