split utils, separate IRVE guess

This commit is contained in:
Tykayn 2025-04-11 15:53:23 +02:00 committed by tykayn
parent b4c28335b2
commit a732edc228
12 changed files with 460 additions and 363 deletions

View file

@ -18,6 +18,8 @@ function debugLog(...args: any[]) {
}
}
const truthyValues = [true, 'true', 'True', 'TRUE', '1', 'yes', 1]
const falsyValues = [false, 'false', 'False', 'FALSE', '0', 'no', 0]
let listOfBooleanKeys = [
"prise_type_ef",
@ -31,6 +33,21 @@ let listOfBooleanKeys = [
]
function boolToAddable(someBooleanValue: boolean) {
return someBooleanValue ? 1 : 0
}
function isTruthyValue(someValue: string) {
let convertedValue;
if (truthyValues.indexOf(someValue) !== -1) {
convertedValue = true
}
if (falsyValues.indexOf(someValue) !== -1) {
convertedValue = false
}
return convertedValue
}
/**
*
* @param pointKeyName
@ -121,10 +138,20 @@ function truncate_enums_to_limit(str: string, limit: number = 255) {
}
export default {
// debug tools
debugLog,
// typing
boolToAddable,
isBooleanKey,
writeFile,
isTruthyValue,
truthyValues,
falsyValues,
// research
find_max_in_string,
// formatting
truncate_enums_to_limit,
prefix_phone_fr_only,
// file tools
writeFile,
}