Accept a new option, formatFunction, that converts numbers to strings

This new option overrides the `format` option, providing increased flexibility, e.g. for applications that use locale-specific number formatting. `formatFunction` can be any map from numerical values to strings.