You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@teselagen/range-utils

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@teselagen/range-utils - npm Package Compare versions

Comparing version

to
0.3.14-beta.1

2

adjustRangeToDeletionOfAnotherRange.d.ts

@@ -1,1 +0,1 @@

export default function adjustRangeToDeletionOfAnotherRange(rangeToBeAdjusted: any, anotherRange: any, maxLength: any): object;
export default function adjustRangeToDeletionOfAnotherRange(rangeToBeAdjusted: any, anotherRange: any, maxLength: any): object | null;
{
"name": "@teselagen/range-utils",
"version": "0.3.13",
"version": "0.3.14-beta.1",
"type": "module",

@@ -5,0 +5,0 @@ "dependencies": {

@@ -20,35 +20,38 @@ import splitRangeIntoTwoPartsIfItIsCircular from "./splitRangeIntoTwoPartsIfItIsCircular";

);
if (trimmedRange) {
//if there is a range left after being trimmed, adjust it by the deleted anotherRange
//we can make some awesome logical simplifications because we know that the two ranges do not overlap (since we've already trimmed the rangeToBeAdjusted)
const nonCircularDeletionRanges = splitRangeIntoTwoPartsIfItIsCircular(
anotherRange,
maxLength
);
nonCircularDeletionRanges.forEach(function (nonCircularDeletionRange) {
const deletionLength =
nonCircularDeletionRange.end - nonCircularDeletionRange.start + 1;
if (trimmedRange.start > trimmedRange.end) {
//the trimmed range is circular
if (nonCircularDeletionRange.start < trimmedRange.end) {
trimmedRange.start -= deletionLength;
trimmedRange.end -= deletionLength;
} else if (nonCircularDeletionRange.start < trimmedRange.start) {
trimmedRange.start -= deletionLength;
} else {
//do nothing
}
if (!trimmedRange) {
return null; // Explicitly return null when range is completely trimmed
}
//if there is a range left after being trimmed, adjust it by the deleted anotherRange
//we can make some awesome logical simplifications because we know that the two ranges do not overlap (since we've already trimmed the rangeToBeAdjusted)
const nonCircularDeletionRanges = splitRangeIntoTwoPartsIfItIsCircular(
anotherRange,
maxLength
);
nonCircularDeletionRanges.forEach(function (nonCircularDeletionRange) {
const deletionLength =
nonCircularDeletionRange.end - nonCircularDeletionRange.start + 1;
if (trimmedRange.start > trimmedRange.end) {
//the trimmed range is circular
if (nonCircularDeletionRange.start < trimmedRange.end) {
trimmedRange.start -= deletionLength;
trimmedRange.end -= deletionLength;
} else if (nonCircularDeletionRange.start < trimmedRange.start) {
trimmedRange.start -= deletionLength;
} else {
if (nonCircularDeletionRange.start < trimmedRange.start) {
trimmedRange.start -= deletionLength;
trimmedRange.end -= deletionLength;
} else if (nonCircularDeletionRange.start < trimmedRange.end) {
trimmedRange.end -= deletionLength;
} else {
//do nothing
}
//do nothing
}
});
}
} else {
if (nonCircularDeletionRange.start < trimmedRange.start) {
trimmedRange.start -= deletionLength;
trimmedRange.end -= deletionLength;
} else if (nonCircularDeletionRange.start < trimmedRange.end) {
trimmedRange.end -= deletionLength;
} else {
//do nothing
}
}
});
return trimmedRange;
}
import convertRangeIndices from "./convertRangeIndices";
import chai from "chai";
import * as chai from "chai";
chai.should();

@@ -4,0 +4,0 @@ describe("convertRangeIndices", function () {

import expandOrContractRangeByLength from "./expandOrContractRangeByLength";
import chai from "chai";
import * as chai from "chai";
chai.should();

@@ -4,0 +4,0 @@

/* eslint-disable no-var*/
import flipContainedRange from "./flipContainedRange";
import chai from "chai";
import * as chai from "chai";
chai.should();

@@ -6,0 +6,0 @@

import getRangeLength from "./getRangeLength";
import generateRandomRange from "./generateRandomRange";
import chai from "chai";
import * as chai from "chai";
chai.should();

@@ -5,0 +5,0 @@

import getAnnotationRangeType from "./getAnnotationRangeType";
import chai from "chai";
import * as chai from "chai";
chai.should();

@@ -4,0 +4,0 @@

import invertRange from "./invertRange";
import chai from "chai";
import * as chai from "chai";
chai.should();

@@ -4,0 +4,0 @@ describe("invertRange", function () {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet