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

skip undefined attributes #5

Merged

Conversation

Marshevskyy
Copy link

@Marshevskyy Marshevskyy commented Mar 2, 2020

in order to support the same functionality (skip attributes when passing undefined) as you had with xmlbuilder v1. Added small fix.

one more reason why I added this fix is:
when we using TypeScript with optional values as function arguments we do not want to set null as a default value, and we want to use original argument value, which is undefined by default (if the case if we do not pass value)

instead of:

  constructor(closed?: boolean) {
    this.node = parentNode
      .element('RoomType')
      .attribute('id', exRoomId);

    if (closed != null) {
      this.node.attribute('closed', closed);
    } 

we want to use it like

  constructor(closed?: boolean) {
    this.node = parentNode
      .element('RoomType')
      .attribute('id', exRoomId);

    this.node.attribute('closed', closed); // in case if closed undeffined I expect to skip this att

@codecov-io
Copy link

codecov-io commented Mar 2, 2020

Codecov Report

Merging #5 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master       #5   +/-   ##
=======================================
  Coverage   99.46%   99.46%           
=======================================
  Files          13       13           
  Lines        1669     1669           
  Branches      482      482           
=======================================
  Hits         1660     1660           
  Misses          9        9
Impacted Files Coverage Δ
src/builder/XMLBuilderImpl.ts 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update df7f72f...e25ff6a. Read the comment docs.

@oozcitak oozcitak merged commit c48e8c9 into oozcitak:master Mar 3, 2020
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.

3 participants