Coverage

100%
11
11
0

/Users/sebastiansandqvist/Documents/Sites & Projects/apps/modules/s-creditcard/index.js

100%
11
11
0
LineHitsSource
11'use strict';
2
3// ----- dependencies
4// ---------------------------------------
51var valid = require('s-valid');
6
7
8// ----- exported function
9// ---------------------------------------
101module.exports = function card(input) {
11
1227 if (typeof input !== 'string') {
132 throw(new TypeError('Card input must be a string'));
14 }
15
1625 for (var type in valid._regexps.creditCard) {
17
18153 if (valid.card[type](input)) {
1922 return type;
20 }
21
22 }
23
243 if (valid.creditCard(input)) {
251 return 'other';
26 }
27
282 return 'none';
29
30};