Function rawToPool
has 80 lines of code (exceeds 25 allowed). Consider refactoring.
let rawToPool = function (midiJson) {
let list = new TimedEvents();
let upThis = this;
let timeDiv = midiJson.timeDivision,
Function renderSect
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
let renderSect = function (data, offX, offY, boundX, boundY, pixelSize, isTwoByOne) {
if (resourceViewer && data) {
for (let i = 0; i < data.length; i ++) {
let iX = i % data.width, iY = (i - iX) / data.width;
if (iX < boundX && iY < boundY) {
Function sysexBitmap
has 63 lines of code (exceeds 25 allowed). Consider refactoring.
let sysexBitmap = function (frameData, type = "xg", frameId = 0, noCopy) {
if (!frameData?.length) {
throw Error(`Blank frame data`);
};
Function sysexBitmap
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
let sysexBitmap = function (frameData, type = "xg", frameId = 0, noCopy) {
if (!frameData?.length) {
throw Error(`Blank frame data`);
};
Function arrowGen
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
let arrowGen = function (charArr, value, border, unit) {
let boundLow = border - (unit >> 1), boundHi = border + (unit >> 1);
if (value > border) {
for (let c = 0; value > border; c ++) {
charArr[c] = (value < boundHi) ? "=" : ">";
Function loadResource
has 31 lines of code (exceeds 25 allowed). Consider refactoring.
let loadResource = async () => {
if (resourceBlob) {
resourceViewer = new [MxBmDef, MxBm256, MxFont40, MxFont176][loadType.data]();
await resourceViewer.load(resourceBlob);
while (rsrcID.options.length > 0) {
Function gOpenSmf
has 30 lines of code (exceeds 25 allowed). Consider refactoring.
self.gOpenSmf = async function () {
useMidiBus = false;
let file = await fileOpen(propsMid);
let fileSplit = file.name.lastIndexOf("."), ext = "";
if (fileSplit > -1) {
Function renderImage
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
let renderImage = function () {
if (resourceViewer && rsrcID.options.length > 0) {
switch (rType.data) {
case 0: {
Function fileReadAs
has 27 lines of code (exceeds 25 allowed). Consider refactoring.
let fileReadAs = function (blob, target) {
let reader = new FileReader();
return new Promise((success, failure) => {
reader.addEventListener("abort", () => {
failure(new Error("Blob read aborted"));
Consider simplifying this complex logical expression.
if (document.fullscreen || document.mozFullscreen || document.webkitFullscreen) {
(document.exitFullscreen || document.mozExitFullscreen || document.webkitExitFullscreen).apply(document);
} else {
let cc = $e(".cambiare");
(cc.requestFullscreen || cc.mozRequestFullscreen || cc.webkitRequestFullscreen).apply(cc);
Function renderSect
has 7 arguments (exceeds 4 allowed). Consider refactoring.
let renderSect = function (data, offX, offY, boundX, boundY, pixelSize, isTwoByOne) {
Function customInterpreter
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
let customInterpreter = function (type, file, rawMtLen) {
let u8Data = [];
let metaLength = rawMtLen == false ? file.readIntVLV() : rawMtLen;
if (type == 0 || type == 127) {
Function replaceAll
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
String.prototype.replaceAll = String.prototype.replaceAll || function (source, target) {
let antiLoop = 0, maxSafe = 16;
let indexFinder = this, indexes = [];
while (antiLoop < maxSafe && indexFinder.lastIndexOf(source) > -1) {
let index = indexFinder.lastIndexOf(source);