Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor!: do less when no formatting is needed, renames attributes - BREAKING #45

Merged
merged 2 commits into from
Feb 24, 2024

Conversation

sverweij
Copy link
Owner

@sverweij sverweij commented Feb 24, 2024

Description

  • stops doing a function call (or even importing the formatter) when no formatting is needed
  • renames lots of things for clarity and grammatical correctness. The BREAKING bit: the changeType attribute in an IChange is now called type (BREAKING)
  • with this, simplifies the format function to have 0 branches
  • also ensures we use node:assert/strict always over node:assert

Motivation and Context

  • when running this as a library function this reduces overhead, bot on import (as the formatting function is imported only then when it's needed) and at runtime (skipping 2 function calls and a lookup).
  • clear and concise naming makes using the package easier.

As a side effect of this PR the distribution size of the package reduces from 6.1kB (17.1kB unpacked) to 5.9kb (16.9kB unpacked)

How Has This Been Tested?

  • green ci
  • adapted automated non-regression tests

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • Documentation only change
  • Refactor (non-breaking change which fixes an issue without changing functionality)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • 📖

    • My change doesn't require a documentation update, or ...
    • it does and I have updated it
  • ⚖️

    • The contribution will be subject to The MIT license, and I'm OK with that.
    • The contribution is my own original work.
    • I am ok with the stuff in CONTRIBUTING.md.

…EAKING

+ rename lots of things for clarity and grammatical correctness
+ with this, simplify the format function to have 0 branches
…' and updates colors of the graph to more sane ones
@sverweij sverweij changed the title refactor!: don't do a function call when no formatting is needed, renames attributes - BREAKING refactor!: do less when no formatting is needed, renames attributes - BREAKING Feb 24, 2024
@sverweij sverweij merged commit 763f292 into main Feb 24, 2024
4 checks passed
@sverweij sverweij deleted the refactor/performance-optimization-and-naming-things branch February 24, 2024 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant