Coverage

100%
12
12
0

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

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