fix default file reader bug

This commit is contained in:
pakintada@gmail.com 2024-01-17 17:38:23 +07:00
parent 21109e4bf9
commit db131d10c0
15 changed files with 636 additions and 254 deletions

View file

@ -1,3 +1,5 @@
import { Tuple } from "./tuple";
var rangeMaterialMapping: { [key: string]: (id: number) => boolean } = {
soda: (id: number) => id == 1031,
water: (id: number) => id == 1,
@ -92,5 +94,24 @@ export var stringParamsDefinition: { [key: string]: string } = {
export var conditionTests: { [key: string]: (arg: any) => boolean } = {
'not-zero': (arg: any) => arg != 0,
'zero': (arg: any) => arg == 0,
'false-if-another-exist': (arg: any) => arg[1] != undefined
}
export var countryMap: Tuple<string, string>[] = [
new Tuple<string, string>('tha', 'Thailand'),
new Tuple<string, string>('mys', 'Malaysia'),
new Tuple<string, string>('aus', 'Australia'),
];
export function getCountryMapSwitcher(param: string) {
console.log("param = ", param);
for (const country of countryMap) {
if(country.first == param || country.second == param){
return country.switchGet(param);
}
}
}

View file

@ -0,0 +1,15 @@
export class Tuple<T, U> {
constructor(public first: T, public second: U) {}
public get(): [T, U] {
return [this.first, this.second];
}
public switchGet(elem: any): any{
if(elem == this.first){
return this.second;
} else {
return this.first;
}
}
}