Skip to main content

format

Function format 

Source
pub fn format(args: &[Value]) -> Result<String, String>
Expand description

util.format(fmt, ...args) — printf-style substitution (%s %d %i %f %j %o %O %c %%) with any leftover arguments appended space-separated. Fallible because three of the directives can throw and node lets those throws out: %j on a BigInt is TypeError: Do not know how to serialize a BigInt, and %d/%i/%f on a value whose coercion reaches a Symbol is TypeError: Cannot convert a Symbol value to a string. Returning a bare String meant each of those printed undefined or NaN instead.