Closed Repraance closed 3 years ago
I met this issue when I test with pino. I noticed there is a similar issue https://github.com/davidmarkclements/quick-format-unescaped/issues/18 But it seems there are still some other issues when a format string next to one another.
The detail would be
const format = require('quick-format-unescaped') console.log(format('%d%d', [11, 22])); console.log(format('%d%s', [11, 22])); console.log(format('%d%o', [11, { aa: 22 }])); console.log(format('%d%d%d', [11, 22, 33])); console.log(format('%d%d%s', [11, 22, 33])); console.log(format('%d%o%d%s', [11, { aa: 22 }, 33, 'sss'])) console.log(format('%d%%%d', [11, 22])); console.log(format('%d%%%s', [11, 22])); console.log('\n'); console.log(format('%s%d', [11, 22])); // console.log(format('%s%s', [11, 22])); console.log(format('%s%o', [11, { aa: 22 }])); console.log(format('%s%d%d', [11, 22, 33])); console.log(format('%s%d%s', [11, 22, 33])); console.log(format('%s%o%d%s', [11, { aa: 22 }, 33, 'sss'])) console.log(format('%s%%%d', [11, 22])); console.log(format('%s%%%s', [11, 22]));
These produce:
11%d 11%s 11%o 11%d22 11%d22 11%oNaN%s 11%%d 11%%s 1122 1122 11{"aa":22} 1122%d 1122%s 11{"aa":22}33%s 11%22 11%22
Would you like to send a Pull Request to address this issue? Remember to add unit tests.
OK, I'll have a try at the weekends.
I met this issue when I test with pino. I noticed there is a similar issue https://github.com/davidmarkclements/quick-format-unescaped/issues/18 But it seems there are still some other issues when a format string next to one another.
The detail would be
These produce: