Skip to content

Refactoring #1

Open
Open
@alxwrd

Description

@alxwrd

_format_fields seems clunky. The Javascript implementation in ratlog/ratlog.js seems a lot clearer

  const fieldString = Object.entries(fields || {})
    .map(([k, v]) => {
      const key = formatField(k)
      const value = formatField(v)
      return ` | ${key}${value && ': ' + value}`
    }).join('')

I also don't like the hacky newline escaping in escape. However,

newline = "\n"
print(repr("\\" + newline))
# '\\\n'

It's possible to string.replace("\n", "\\n"), but this just adds a special case for newlines. I don't know if this is better?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions