# All files / blue-button/lib/parser/ccda cleanup.js

54.83% Statements 17/31
50% Branches 2/4
100% Functions 2/2
54.83% Lines 17/31

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    321x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    13x

    13x
    13x
    1x
    1x
    13x

    13x
    13x
     "use strict";

    var includeCleanup = require("../common/cleanup");

    var cleanup = module.exports = Object.create(includeCleanup);

    var _ = require("lodash");

    cleanup.promoteAllergenNameIfNoAllergen = function () {
      if (this.js && (!_.get(this, "js.allergen"))) {
        var name = this.js.allergenName && this.js.allergenName.js;
        if (name) {
          this.js.allergen = {
            name: name
          };
        }
      }
      delete this.js.allergenName;
    };

    cleanup.promoteFreeTextIfNoReaction = function () {
      if (this.js && (!_.get(this, "js.reaction"))) {
        var name = this.js.free_text_reaction && this.js.free_text_reaction.js;
        if (name) {
          this.js.reaction = {
            name: name
          };
        }
      }
      delete this.js.free_text_reaction;
    };