Skip to content

Commit b36e4af

Browse files
renamed function for cut tool (#29)
1 parent 5e1d6d6 commit b36e4af

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/4/cut.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ function parseFieldListString(str: string) {
105105
return str.replaceAll('"', '').replaceAll(' ', ',');
106106
}
107107

108-
function main(argv: string[] = process.argv): Promise<string> {
108+
function unixCut(argv: string[] = process.argv): Promise<string> {
109109
let delimiter = '\t';
110110
let command = null;
111111
let filename = null;
@@ -141,4 +141,4 @@ function main(argv: string[] = process.argv): Promise<string> {
141141

142142
return processCommand(command, filename, delimiter);
143143
}
144-
export { main };
144+
export { unixCut };

src/4/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { main } from './cut';
1+
import { unixCut } from './cut';
22

33
const func = async () => {
4-
const result = await main();
4+
const result = await unixCut();
55
process.stdout.write(result);
66
};
77

tests/4/cut.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { execSync } from 'child_process';
2-
import { main } from '../../src/4/cut';
2+
import { unixCut } from '../../src/4/cut';
33

44
describe('Testing Field command with input file', () => {
55
const filenames = ['./tests/4/sample.tsv'];
@@ -30,7 +30,7 @@ describe('Testing Field command with input file', () => {
3030
.toString()
3131
.replaceAll('\r', '');
3232
const argv = ['', '', ...options, filename];
33-
const result = await main(argv);
33+
const result = await unixCut(argv);
3434
expect(result.length).toBe(expectedOutput.length);
3535
expect(result).toBe(expectedOutput);
3636
});
@@ -69,7 +69,7 @@ describe('Testing Field command and delimiter command with input file', () => {
6969
.toString()
7070
.replaceAll('\r', '');
7171
const argv = ['', '', ...options, filename];
72-
const result = await main(argv);
72+
const result = await unixCut(argv);
7373
expect(result.length).toBe(expectedOutput.length);
7474
expect(result).toBe(expectedOutput);
7575
});

0 commit comments

Comments
 (0)