Remove cruft
This commit is contained in:
parent
1ff632d817
commit
263841b986
@ -1,5 +1,4 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||||
/* eslint-disable array-callback-return */
|
|
||||||
// Modules
|
// Modules
|
||||||
import { html as beautify } from 'js-beautify';
|
import { html as beautify } from 'js-beautify';
|
||||||
import csv from 'csvtojson';
|
import csv from 'csvtojson';
|
||||||
@ -33,10 +32,8 @@ function isJunk(element: part) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getPartType(component: part) {
|
function getPartType(component: part) {
|
||||||
// console.log(partName.Part);
|
|
||||||
if (component.Part.match(/^C\d/) != null) {
|
if (component.Part.match(/^C\d/) != null) {
|
||||||
return 'C';
|
return 'C';
|
||||||
// eslint-disable-next-line no-else-return
|
|
||||||
} else if (component.Part.match(/^R\d/) != null) {
|
} else if (component.Part.match(/^R\d/) != null) {
|
||||||
return 'R';
|
return 'R';
|
||||||
}
|
}
|
||||||
@ -51,6 +48,7 @@ function getJSONParts(allParts: part[]) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
allParts.map((partEntry: part) => {
|
allParts.map((partEntry: part) => {
|
||||||
|
// Sort parts into capacitors, resistors and others
|
||||||
switch (getPartType(partEntry)) {
|
switch (getPartType(partEntry)) {
|
||||||
case 'C':
|
case 'C':
|
||||||
jsonParts.C[partEntry.Part] = partEntry.Value;
|
jsonParts.C[partEntry.Part] = partEntry.Value;
|
||||||
@ -144,9 +142,8 @@ function makeJSON(csvString: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const csvPicker = document.getElementById('csvFile') as HTMLInputElement;
|
const csvPicker = document.getElementById('csvFile') as HTMLInputElement;
|
||||||
// csvPicker?.addEventListener('change', handleFiles, false);
|
|
||||||
csvPicker.onchange = function handleFiles(event: Event) {
|
csvPicker.onchange = function handleFiles(event: Event) {
|
||||||
// const csvFile = event.target.files[0];
|
|
||||||
const target = event.target as HTMLInputElement;
|
const target = event.target as HTMLInputElement;
|
||||||
const csvFile: File = (target.files as FileList)[0];
|
const csvFile: File = (target.files as FileList)[0];
|
||||||
const reader = new FileReader();
|
const reader = new FileReader();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user