quick-format-unescaped icon indicating copy to clipboard operation
quick-format-unescaped copied to clipboard

Breaking: take in custom formatter option

Open JaneJeon opened this issue 3 years ago • 3 comments

See https://github.com/pinojs/pino/issues/1376

Changes:

  • instead of a default format function, export a builder for the format function instead (this is the breaking bit, and is needed to make this library configurable; I was not able to get it to work using the trick mentioned in the other thread)
  • take in a custom formatters opt and run interpolation with it (the actual feature bit)
  • using predefined consts instead of using magic numbers (please feel free to revert this should you feel the need to)
  • tons of code formatting, I'm really sorry about this, I was too weak to stop vscode/prettier

JaneJeon avatar Mar 19 '22 00:03 JaneJeon

@davidmarkclements bump? https://github.com/pinojs/pino/issues/1376

JaneJeon avatar Jul 16 '22 20:07 JaneJeon

You can make this non-breaking by doing:

function build(opts) { ... }
const formatter = build(theDefaultOpts)
module.exports = formatter
module.exports.build = build

mcollina avatar Jul 18 '22 09:07 mcollina

hey thanks for this

  • let’s not break the API if we don’t need to, @mcollina suggestions seems good to me
  • 👍
  • 👍
  • If any code formatting is applied it will need to be standard linting or else originally formatted before we can merge

davidmarkclements avatar Jul 18 '22 09:07 davidmarkclements