Improved dispatchers with richer results and added predicate and regular expression based dispatchers
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user