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