Skip to content

Commit

Permalink
Improve naming and fix lint issue
Browse files Browse the repository at this point in the history
  • Loading branch information
henryruhs committed Jan 10, 2023
1 parent 2496da5 commit 8d86cca
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/core.class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import glob from 'glob';
import { program } from 'commander';
import { Helper } from './helper.class.js';
import { Option } from './option.class.js';
import { Metadata, Data, Chunk } from './core.interface.js';
import { Metadata, File, Data, Chunk } from './core.interface.js';
import { Options } from './option.interface';

export class Core
Expand Down Expand Up @@ -103,22 +103,22 @@ export class Core
if (mode === 'it')
{
currentIndex = currentIndex + file.sizes.it;
return { file, chunkIndex: this.getChunkIndex(currentIndex, data) };
return { file, chunkIndex: this.calcChunkIndex(currentIndex, data) };
}
else if (mode === 'describe')
{
currentIndex = currentIndex + file.sizes.describe;
return { file, chunkIndex: this.getChunkIndex(currentIndex, data) };
return { file, chunkIndex: this.calcChunkIndex(currentIndex, data) };
}
return { file, chunkIndex: this.getChunkIndex(index, data) };
return { file, chunkIndex: this.calcChunkIndex(index, data) };
})
.map(({ file, chunkIndex }) =>
.map(({ file, chunkIndex } : { file : File, chunkIndex : number }) =>
{
return { filePath: file.filePath, chunkPath: this.getChunkPath(file.filePath, chunkIndex) };
return { filePath: file.filePath, chunkPath: this.buildChunkPath(file.filePath, chunkIndex) };
});
}

protected getChunkPath(filePath : string, chunkIndex : number) : string
protected buildChunkPath(filePath : string, chunkIndex : number) : string
{
const { chunkPrefix, chunkSuffix, path } : Options = this.option.getAll();

Expand All @@ -129,7 +129,7 @@ export class Core
);
}

protected getChunkIndex(currentIndex : number, data : Data) : number
protected calcChunkIndex(currentIndex : number, data : Data) : number
{
const { amount } : Options = this.option.getAll();
const chunkIndex : number = Math.floor(currentIndex / this.perChunk(data));
Expand Down

0 comments on commit 8d86cca

Please sign in to comment.