• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

adobe / reactor-turbine / 26974271630

04 Jun 2026 07:23PM UTC coverage: 18.928% (-77.0%) from 95.912%
26974271630

Pull #201

github

web-flow
Merge 99f374fa8 into 4a42733a4
Pull Request #201: Platir 64071 update vulnerability chain

36 of 379 branches covered (9.5%)

Branch coverage included in aggregate %.

4 of 6 new or added lines in 1 file covered. (66.67%)

640 existing lines in 47 files now uncovered.

197 of 852 relevant lines covered (23.12%)

1.21 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

6.56
/src/createGetVar.js
1
/***************************************************************************************
2
 * (c) 2017 Adobe. All rights reserved.
3
 * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
 * you may not use this file except in compliance with the License. You may obtain a copy
5
 * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
 *
7
 * Unless required by applicable law or agreed to in writing, software distributed under
8
 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
 * OF ANY KIND, either express or implied. See the License for the specific language
10
 * governing permissions and limitations under the License.
11
 ****************************************************************************************/
12

13
var cleanText = require('./cleanText');
3✔
14

15
var specialPropertyAccessors = {
3✔
16
  text: function (obj) {
UNCOV
17
    return obj.textContent;
×
18
  },
19
  cleanText: function (obj) {
UNCOV
20
    return cleanText(obj.textContent);
×
21
  }
22
};
23

24
/**
25
 * This returns the value of a property at a given path. For example, a <code>path<code> of
26
 * <code>foo.bar</code> will return the value of <code>obj.foo.bar</code>.
27
 *
28
 * In addition, if <code>path</code> is <code>foo.bar.getAttribute(unicorn)</code> and
29
 * <code>obj.foo.bar</code> has a method named <code>getAttribute</code>, the method will be
30
 * called with a value of <code>"unicorn"</code> and the value will be returned.
31
 *
32
 * Also, if <code>path</code> is <code>foo.bar.@text</code> or other supported properties
33
 * beginning with <code>@</code>, a special accessor will be used.
34
 *
35
 * @param host
36
 * @param path
37
 * @param supportSpecial
38
 * @returns {*}
39
 */
40
var getObjectProperty = function (host, propChain, supportSpecial) {
3✔
UNCOV
41
  var value = host;
×
42
  var attrMatch;
UNCOV
43
  for (var i = 0, len = propChain.length; i < len; i++) {
×
UNCOV
44
    if (value == null) {
×
UNCOV
45
      return undefined;
×
46
    }
UNCOV
47
    var prop = propChain[i];
×
UNCOV
48
    if (supportSpecial && prop.charAt(0) === '@') {
×
UNCOV
49
      var specialProp = prop.slice(1);
×
UNCOV
50
      value = specialPropertyAccessors[specialProp](value);
×
UNCOV
51
      continue;
×
52
    }
UNCOV
53
    if (
×
54
      value.getAttribute &&
×
55
      (attrMatch = prop.match(/^getAttribute\((.+)\)$/))
56
    ) {
UNCOV
57
      var attr = attrMatch[1];
×
UNCOV
58
      value = value.getAttribute(attr);
×
UNCOV
59
      continue;
×
60
    }
UNCOV
61
    value = value[prop];
×
62
  }
UNCOV
63
  return value;
×
64
};
65

66
/**
67
 * Returns the value of a variable.
68
 * @param {string} variable
69
 * @param {Object} [syntheticEvent] A synthetic event. Only required when using %event... %this...
70
 * or %target...
71
 * @returns {*}
72
 */
73
module.exports = function (
3✔
74
  customVars,
75
  getDataElementDefinition,
76
  getDataElementValue
77
) {
UNCOV
78
  return function (variable, syntheticEvent) {
×
79
    var value;
80

UNCOV
81
    if (getDataElementDefinition(variable)) {
×
82
      // Accessing nested properties of a data element using dot-notation is unsupported because
83
      // users can currently create data elements with periods in the name.
UNCOV
84
      value = getDataElementValue(variable, syntheticEvent);
×
85
    } else {
UNCOV
86
      var propChain = variable.split('.');
×
UNCOV
87
      var variableHostName = propChain.shift();
×
88

UNCOV
89
      if (variableHostName === 'this') {
×
UNCOV
90
        if (syntheticEvent) {
×
91
          // I don't know why this is the only one that supports special properties, but that's the
92
          // way it was in Satellite.
UNCOV
93
          value = getObjectProperty(syntheticEvent.element, propChain, true);
×
94
        }
UNCOV
95
      } else if (variableHostName === 'event') {
×
UNCOV
96
        if (syntheticEvent) {
×
UNCOV
97
          value = getObjectProperty(syntheticEvent, propChain);
×
98
        }
UNCOV
99
      } else if (variableHostName === 'target') {
×
UNCOV
100
        if (syntheticEvent) {
×
UNCOV
101
          value = getObjectProperty(syntheticEvent.target, propChain);
×
102
        }
103
      } else {
UNCOV
104
        value = getObjectProperty(customVars[variableHostName], propChain);
×
105
      }
106
    }
107

UNCOV
108
    return value;
×
109
  };
110
};
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc