A function that formats a string from an object-parameter, and according to the specified configurator.
import {createFormatter, IFormatter} from 'custom-string-formatter';
class BaseFormatter implements IFormatter {
format(value: any): string {
return (value ?? 'null').toString();
}
}
const format = createFormatter(new BaseFormatter());
format('Hello ${title} ${name}!', {title: 'Mr.', name: 'Foreman'});
//=> Hello Mr. Foreman!
Creates a formatter function.