mirror of
https://github.com/iib0011/omni-tools.git
synced 2025-09-22 23:49:31 +02:00
refactor: init
This commit is contained in:
@@ -1,10 +0,0 @@
|
||||
import type { DataTable } from '../types';
|
||||
import wiregauge from './wire_gauge';
|
||||
import material_electrical_properties from './material_electrical_properties';
|
||||
|
||||
const allDataTables: { [key: string]: DataTable } = {
|
||||
'wire-gauge': wiregauge,
|
||||
'material-electrical-properties': material_electrical_properties
|
||||
};
|
||||
|
||||
export default allDataTables;
|
@@ -1,18 +1,8 @@
|
||||
import type { DataTable } from './types.ts';
|
||||
|
||||
export async function getDataTable(name: string): Promise<DataTable> {
|
||||
const allDataTables = (await import('./data/index')).default;
|
||||
return allDataTables[name];
|
||||
}
|
||||
|
||||
/* Used in case later we want any kind of computed extra data */
|
||||
export function dataTableLookup(table: DataTable, key: string): any {
|
||||
return table.data[key];
|
||||
}
|
||||
|
||||
export async function listDataTables(): Promise<{ [name: string]: DataTable }> {
|
||||
const allDataTables = (await import('./data/index')).default;
|
||||
return allDataTables;
|
||||
}
|
||||
|
||||
export { DataTable };
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
Represents a set of rows indexed by a key.
|
||||
Used for calculator presets
|
||||
|
||||
@@ -7,7 +7,7 @@ export interface DataTable {
|
||||
title: string;
|
||||
/* A JSON schema properties */
|
||||
columns: {
|
||||
[key: string]: any;
|
||||
[key: string]: { title: string; type: string; unit: string };
|
||||
};
|
||||
data: {
|
||||
[key: string]: {
|
||||
|
Reference in New Issue
Block a user