fixing names
This commit is contained in:
parent
90fdc7aa06
commit
17b5708d59
12 changed files with 10 additions and 22 deletions
|
|
@ -2,7 +2,7 @@
|
|||
"clearMocks": true,
|
||||
"moduleNameMapper": {
|
||||
"@code/(.*)": [
|
||||
"<rootDir>/src/day4/$1"
|
||||
"<rootDir>/src/day6/$1"
|
||||
]
|
||||
},
|
||||
"preset": "ts-jest"
|
||||
|
|
|
|||
|
|
@ -16,6 +16,6 @@
|
|||
"test": "jest ArrayList"
|
||||
},
|
||||
"kata_stats": {
|
||||
"ArrayList": 2
|
||||
"ArrayList": 4
|
||||
}
|
||||
}
|
||||
|
|
@ -2,40 +2,28 @@
|
|||
module.exports = {
|
||||
ArrayList: {
|
||||
type: "class",
|
||||
name: "array-list.ts",
|
||||
className: "ArrayList",
|
||||
},
|
||||
SinglyLinkedList: {
|
||||
type: "class",
|
||||
name: "single-linked-list.ts",
|
||||
className: "LinkedList",
|
||||
},
|
||||
DoublyLinkedList: {
|
||||
type: "class",
|
||||
name: "doubly-linked-list.ts",
|
||||
className: "LinkedList",
|
||||
},
|
||||
Queue: {
|
||||
type: "class",
|
||||
name: "queue",
|
||||
className: "Queue",
|
||||
},
|
||||
|
||||
Stack: {
|
||||
type: "class",
|
||||
name: "stack",
|
||||
className: "Stack",
|
||||
},
|
||||
|
||||
InsertionSort: {
|
||||
type: "fn",
|
||||
name: "insertion-sort.ts",
|
||||
fn: "insertion_sort",
|
||||
args: "arr: number[]",
|
||||
"return": "void",
|
||||
},
|
||||
MergeSort: {
|
||||
type: "fn",
|
||||
name: "merge-sort.ts",
|
||||
fn: "merge_sort",
|
||||
args: "arr: number[]",
|
||||
"return": "void",
|
||||
|
|
|
|||
|
|
@ -29,16 +29,16 @@ const day_path = path.join(src_path, day_name);
|
|||
try { fs.unlinkSync(day_path); } catch (e) { }
|
||||
try { fs.mkdirSync(day_path); } catch (e) { }
|
||||
|
||||
function create_class(item) {
|
||||
fs.writeFileSync(path.join(day_path, item.name), `export default class ${item.className} {
|
||||
function create_class(name, item) {
|
||||
fs.writeFileSync(path.join(day_path, `${name}.ts`), `export default class ${name} {
|
||||
constructor() {
|
||||
|
||||
}
|
||||
}`);
|
||||
}
|
||||
|
||||
function create_function(item) {
|
||||
fs.writeFileSync(path.join(day_path, item.name), `export default function ${item.fn}(${item.args}): ${item.return} {
|
||||
function create_function(name, item) {
|
||||
fs.writeFileSync(path.join(day_path, `${name}.ts`), `export default function ${item.fn}(${item.args}): ${item.return} {
|
||||
|
||||
}`);
|
||||
}
|
||||
|
|
@ -46,9 +46,9 @@ function create_function(item) {
|
|||
config.dsa.forEach(ds => {
|
||||
const item = dsa[ds];
|
||||
if (item.type === "class") {
|
||||
create_class(item);
|
||||
create_class(ds, item);
|
||||
} else {
|
||||
create_function(item);
|
||||
create_function(ds, item);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
"baseUrl": "src",
|
||||
"paths": {
|
||||
"@code/*": [
|
||||
"day4/*"
|
||||
"day6/*"
|
||||
]
|
||||
}
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue