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

recurly / recurly-js / #3086

19 May 2025 06:36PM UTC coverage: 15.063% (-75.9%) from 90.977%
#3086

push

web-flow
Merge 5db5ad294 into 091bd26d5

128 of 1914 branches covered (6.69%)

2 of 5 new or added lines in 3 files covered. (40.0%)

2759 existing lines in 86 files now uncovered.

548 of 3638 relevant lines covered (15.06%)

1.34 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