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: avoid nullish coalescing operator (??) #14

Merged
merged 1 commit into from
Sep 27, 2023

Conversation

mlrawlings
Copy link
Member

@mlrawlings mlrawlings commented Sep 27, 2023

Description

Avoids the usage of the nullish coalescing operator (??)

Old

<div class=`${value ?? ""}`/>

New

static function _toString(value) {
  return value == null ? "" : value;
}

<div class=`${_toString(value)}`/>

Motivation and Context

As this is a compat layer for applications that existed before ?? was part of the language, there have been instances where existing application dependencies (older versions of babylon for instance) don't support the new syntax.

Screenshots (if appropriate):

Checklist:

  • I have updated/added documentation affected by my changes.
  • I have added tests to cover my changes.

@codecov
Copy link

codecov bot commented Sep 27, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (5f39ccd) 87.95% compared to head (757e1c4) 88.03%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #14      +/-   ##
==========================================
+ Coverage   87.95%   88.03%   +0.07%     
==========================================
  Files          55       55              
  Lines        4759     4790      +31     
  Branches      718      719       +1     
==========================================
+ Hits         4186     4217      +31     
  Misses        551      551              
  Partials       22       22              
Files Coverage Δ
...rc/migrate/non-standard-template-literals/index.ts 86.58% <100.00%> (+3.12%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@DylanPiercey DylanPiercey merged commit c0e4c32 into main Sep 27, 2023
@DylanPiercey DylanPiercey deleted the avoid-nullish-coalescing-operator branch September 27, 2023 20:32
@github-actions github-actions bot mentioned this pull request Sep 28, 2023
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.

2 participants