refactor: resolve biome lint findings
Prepare the sources for switching the linter from ESLint to Biome. - Use template literals instead of string concatenation - Use the ** operator instead of Math.pow - Drop a redundant continue and annotate an untyped let - Remove the eslint-disable-line comments
This commit is contained in:
+33
-33
@@ -201,36 +201,36 @@ class G3D {
|
||||
return;
|
||||
}
|
||||
let message = '--- g3d information ---\n';
|
||||
message += 'magic: : ' + this.header.magic.toString(16) + '\n';
|
||||
message += 'width [pixel]: ' + this.header.width.toString() + '\n';
|
||||
message += 'height [pixel]: ' + this.header.height.toString() + '\n';
|
||||
message += 'depth [pixel]: ' + this.header.depth.toString() + '\n';
|
||||
message += 'org_width [pixel]: ' + this.header.org_width.toString() + '\n';
|
||||
message += 'org_height [pixel]: ' + this.header.org_height.toString() + '\n';
|
||||
message += 'org_depth [pixel]: ' + this.header.org_depth.toString() + '\n';
|
||||
message += 'datatype [byte] : ' + this.header.datatype.toString() + '\n';
|
||||
message += 'unit [m|E] : ' + this.header.unit.toString() + '\n';
|
||||
message += 'grid [unit] : ' + this.header.grid.toString() + '\n';
|
||||
message += 'surface voxel[unit] : ' + this.header.vs_width.toString() + '\n';
|
||||
message += 'voxel width [unit] : ' + this.header.v_width.toString() + '\n';
|
||||
message += 'voxel height [unit] : ' + this.header.v_height.toString() + '\n';
|
||||
message += 'voxel depth [unit] : ' + this.header.v_depth.toString() + '\n';
|
||||
message += 'ax [deg] : ' + this.header.ax.toString() + '\n';
|
||||
message += 'ay [deg] : ' + this.header.ay.toString() + '\n';
|
||||
message += 'az [deg] : ' + this.header.az.toString() + '\n';
|
||||
message += 'ox [pixel]: ' + this.header.ox.toString() + '\n';
|
||||
message += 'oy [pixel]: ' + this.header.oy.toString() + '\n';
|
||||
message += 'oz [pixel]: ' + this.header.oz.toString() + '\n';
|
||||
message += 'ox_real [unit] : ' + (this.header.ox * this.header.vs_width).toString() + '\n';
|
||||
message += 'oy_real [unit] : ' + (this.header.oy * this.header.vs_width).toString() + '\n';
|
||||
message += 'oz_real [unit] : ' + (this.header.oz * this.header.vs_width).toString() + '\n';
|
||||
message += 'surface voxels : ' + this.header.s_num.toString() + '\n';
|
||||
message += 'threshold : ' + this.header.s_th.toString() + '\n';
|
||||
message += 'date : ' + this.header.date + '\n';
|
||||
message += 'coordinate : ' + this.header.coordinate + '\n';
|
||||
message += 'subject : ' + this.header.subject + '\n';
|
||||
message += 'memo : ' + this.header.memo + '\n';
|
||||
message += 'File Type : ' + (this.isLittleEndianFile ? 'Little Endian.' : 'Big Endian');
|
||||
message += `magic: : ${this.header.magic.toString(16)}\n`;
|
||||
message += `width [pixel]: ${this.header.width.toString()}\n`;
|
||||
message += `height [pixel]: ${this.header.height.toString()}\n`;
|
||||
message += `depth [pixel]: ${this.header.depth.toString()}\n`;
|
||||
message += `org_width [pixel]: ${this.header.org_width.toString()}\n`;
|
||||
message += `org_height [pixel]: ${this.header.org_height.toString()}\n`;
|
||||
message += `org_depth [pixel]: ${this.header.org_depth.toString()}\n`;
|
||||
message += `datatype [byte] : ${this.header.datatype.toString()}\n`;
|
||||
message += `unit [m|E] : ${this.header.unit.toString()}\n`;
|
||||
message += `grid [unit] : ${this.header.grid.toString()}\n`;
|
||||
message += `surface voxel[unit] : ${this.header.vs_width.toString()}\n`;
|
||||
message += `voxel width [unit] : ${this.header.v_width.toString()}\n`;
|
||||
message += `voxel height [unit] : ${this.header.v_height.toString()}\n`;
|
||||
message += `voxel depth [unit] : ${this.header.v_depth.toString()}\n`;
|
||||
message += `ax [deg] : ${this.header.ax.toString()}\n`;
|
||||
message += `ay [deg] : ${this.header.ay.toString()}\n`;
|
||||
message += `az [deg] : ${this.header.az.toString()}\n`;
|
||||
message += `ox [pixel]: ${this.header.ox.toString()}\n`;
|
||||
message += `oy [pixel]: ${this.header.oy.toString()}\n`;
|
||||
message += `oz [pixel]: ${this.header.oz.toString()}\n`;
|
||||
message += `ox_real [unit] : ${(this.header.ox * this.header.vs_width).toString()}\n`;
|
||||
message += `oy_real [unit] : ${(this.header.oy * this.header.vs_width).toString()}\n`;
|
||||
message += `oz_real [unit] : ${(this.header.oz * this.header.vs_width).toString()}\n`;
|
||||
message += `surface voxels : ${this.header.s_num.toString()}\n`;
|
||||
message += `threshold : ${this.header.s_th.toString()}\n`;
|
||||
message += `date : ${this.header.date}\n`;
|
||||
message += `coordinate : ${this.header.coordinate}\n`;
|
||||
message += `subject : ${this.header.subject}\n`;
|
||||
message += `memo : ${this.header.memo}\n`;
|
||||
message += `File Type : ${this.isLittleEndianFile ? 'Little Endian.' : 'Big Endian'}`;
|
||||
console.log(message);
|
||||
}
|
||||
|
||||
@@ -389,7 +389,7 @@ class G3D {
|
||||
}
|
||||
case 1: {
|
||||
this._transSurface(cutdepth, pdimg, irc);
|
||||
let pos;
|
||||
let pos: number;
|
||||
for (let j = (pos = 0); j < this.imageSize; j++) {
|
||||
for (let i = 0; i < this.imageSize; i++, pos++) {
|
||||
let pdPos = pdimg[pos];
|
||||
@@ -999,7 +999,7 @@ class G3D {
|
||||
}
|
||||
|
||||
private _fround(x: number, n: number) {
|
||||
return Math.round(x * Math.pow(10, n)) / Math.pow(10, n);
|
||||
return Math.round(x * 10 ** n) / 10 ** n;
|
||||
}
|
||||
|
||||
private _initialize(data: ArrayBuffer): boolean {
|
||||
@@ -1054,7 +1054,7 @@ class G3D {
|
||||
date: decoder.decode(new Uint8Array(data, (headerOffset += 256), 32)).replace(/\0+$/, ''),
|
||||
coordinate: decoder.decode(new Uint8Array(data, (headerOffset += 32), 32)).replace(/\0+$/, ''),
|
||||
subject: decoder.decode(new Uint8Array(data, (headerOffset += 32), 256)).replace(/\0+$/, ''),
|
||||
memo: decoder.decode(new Uint8Array(data, (headerOffset += 256), 256)).replace(/\0+$/, ''), // eslint-disable-line no-useless-assignment
|
||||
memo: decoder.decode(new Uint8Array(data, (headerOffset += 256), 256)).replace(/\0+$/, ''),
|
||||
};
|
||||
// set surface and image views
|
||||
const surfaceOffset = 964;
|
||||
|
||||
+2
-3
@@ -189,7 +189,6 @@ class M3D {
|
||||
if (pix > th) {
|
||||
this._drawPixel(img, pos, pix, pix, pix);
|
||||
ddimg[pos] = cutdepth;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -574,7 +573,7 @@ class M3D {
|
||||
}
|
||||
|
||||
private _fround(x: number, n: number) {
|
||||
return Math.round(x * Math.pow(10, n)) / Math.pow(10, n);
|
||||
return Math.round(x * 10 ** n) / 10 ** n;
|
||||
}
|
||||
|
||||
private _initialize(): void {
|
||||
@@ -606,7 +605,7 @@ class M3D {
|
||||
oz: view.getFloat64((offset += 8), isLittleEndianFile),
|
||||
dlen: view.getInt32((offset += 8), isLittleEndianFile),
|
||||
dth: view.getInt32((offset += 4), isLittleEndianFile),
|
||||
memo: decoder.decode(new Uint8Array(this.data, (offset += 4), 256)).replace(/\0+$/, ''), // eslint-disable-line no-useless-assignment
|
||||
memo: decoder.decode(new Uint8Array(this.data, (offset += 4), 256)).replace(/\0+$/, ''),
|
||||
};
|
||||
// swap byte order if endian is not matched
|
||||
if ((this.isBigEndian() && isLittleEndianFile) || (!this.isBigEndian() && !isLittleEndianFile)) {
|
||||
|
||||
Reference in New Issue
Block a user