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

recurly / recurly-js / #3100

06 Jun 2025 05:34PM UTC coverage: 15.094% (-76.0%) from 91.071%
#3100

push

web-flow
Merge 1acbf17f9 into a8ccd414c

126 of 1921 branches covered (6.56%)

4 of 9 new or added lines in 4 files covered. (44.44%)

2774 existing lines in 86 files now uncovered.

552 of 3657 relevant lines covered (15.09%)

1.05 hits per line

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

0.0
/lib/util/normalize.js
1
import dom from './dom';
2
import each from 'component-each';
3
import { parseCard } from '../util/parse-card';
4

5
/**
6
 * Parses options out of a form element and normalizes according to an allowlist.
7
 *
8
 * @param {Object|HTMLFormElement} input
9
 * @param {Array} allowlist of field names
10
 * @param {Object} [options]
11
 * @param {Boolean} [options.parseCard] whether to parse the card number value
12
 * @return {Object}
13
 */
14

15
export function normalize (input, allowlist, options = {}) {
×
UNCOV
16
  let data = { fields: {}, values: {} };
×
UNCOV
17
  let el = dom.element(input);
×
18

UNCOV
19
  if (el && 'form' === el.nodeName.toLowerCase()) {
×
UNCOV
20
    each(el.querySelectorAll('[data-recurly]'), function (field) {
×
UNCOV
21
      let name = dom.data(field, 'recurly');
×
UNCOV
22
      if (~allowlist.indexOf(name)) {
×
UNCOV
23
        data.fields[name] = field;
×
UNCOV
24
        data.values[name] = dom.value(field);
×
25
      }
26
    });
27
  } else {
UNCOV
28
    data.values = input;
×
29
  }
30

UNCOV
31
  if (options.parseCard) {
×
UNCOV
32
    data.values.number = parseCard(data.values.number);
×
33
  }
34

UNCOV
35
  return data;
×
36
}
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