Closed hbacelar closed 5 years ago
This PR is related the following issue on pino: 595
When the fmt param is null, the code assumes that the first args element is the new fmt. This makes the module have the following behaviour:
Example:
format(null, ['foo %s', 'bar %s', 'baz'])
Output:
'foo bar %s baz'
But a problem arises when the arg[0] is also null, throwing a TypeError.
format(null, [null, 'foo'])
TypeError: Cannot read property 'length' of null at format (quick-format-unescaped/index.js:31:16)
This is inconsistent with this case that doesn't throw:
format(null, ['foo', null])
'foo null'
This commit tries to fix that. A call like format(null, [null, 'foo']) will return 'null foo'.
very nice thank you!
This PR is related the following issue on pino: 595
When the fmt param is null, the code assumes that the first args element is the new fmt. This makes the module have the following behaviour:
Example:
Output:
But a problem arises when the arg[0] is also null, throwing a TypeError.
This is inconsistent with this case that doesn't throw:
Output:
This commit tries to fix that. A call like format(null, [null, 'foo']) will return 'null foo'.