pinojs / quick-format-unescaped

Solves a problem with util.format
MIT License
17 stars 13 forks source link

Return empty string when called with no args #24

Closed n4zukker closed 3 years ago

n4zukker commented 5 years ago

The result of util.format() is an empty string. The result of quick-format-unescaped.format() is a TypeError.

> require('util').format()
''
> const format = require('quick-format-unescaped')
undefined
> format()
TypeError: Cannot read property 'length' of undefined
    at format (.../node_modules/quick-format-unescaped/index.js:25:21)
>

This PR fixes that so '' is returned and quick-format-unescaped.format() more closely matches util.format().

mcollina commented 3 years ago

Unfortunately this caused a significant regression in pino.