Evaluate console.log
format specifiers (eg: %O
) before logging.
Format specifiers:
%O
Usepretty-format
before insertion%s
UseString(value)
before insertion%f
UseNumber(value)
before insertion%d
UseMath.floor(value)
before insertion (alias:%i
)
import format from '@alloc/log-format'
format('a: %O, b: %O', /.+/, new Date)
// => 'a: /.+/, b: 2020-06-26T18:39:40.258Z'
format({ a: [1, 2], b: new Set([3, 4]) })
// => '{"a": [1, 2], "b": Set {3, 4}}'