Improved dispatchers with richer results and added predicate and regular expression based dispatchers

This commit is contained in:
2026-04-12 19:12:00 +02:00
parent 225990b22d
commit cf1abadfc9
8 changed files with 173 additions and 28 deletions

View File

@@ -15,6 +15,12 @@ export function typed_value(coercion_function, default_value, description) {
return new Field_Configuration(null, coercion_function, () => default_value, description);
}
export function boolean(default_value, description) {
//BUG: Text representations such as "false" is still truthy here - we should have a more capable coearcing function
return new Field_Configuration(null, Boolean, () => default_value, description);
}
export function typed_factory(coercion_function, factory_function, description) {
return new Field_Configuration(null, coercion_function, factory_function, description);
}

View File

@@ -46,6 +46,6 @@ export function *indented_line_iterator(settings, text) {
break;
}
default:
throw new Error('Unsupported indention mode'); //TODO - proper error
throw new Error(`Unsupported indention mode: ${settings.indention_mode}`); //TODO - proper error
}
}