Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function parseExpiration( value ) {
const [ month, year ] = value.split( '/' );
return {
month: creditcards.expiration.month.parse( month ),
year: creditcards.expiration.year.parse( year, true ),
};
}
function parseExpiration( value ) {
const [ month, year ] = value.split( '/' );
return {
month: creditcards.expiration.month.parse( month ),
year: creditcards.expiration.year.parse( year, true ),
};
}
function parseExpiration( value ) {
const [ month, year ] = value.split( '/' );
return {
month: creditcards.expiration.month.parse( month ),
year: creditcards.expiration.year.parse( year, true ),
};
}
'use strict'
var expiration = require('creditcards').expiration
var month = expiration.month
var year = expiration.year
var ap = require('ap')
exports = module.exports = function ccExp () {
return {
restrict: 'AE',
require: 'ccExp',
controller: CcExpController,
link: function (scope, element, attributes, ccExp) {
ccExp.$watch()
}
}
}
CcExpController.$inject = ['$scope', '$element']
isValid: function( value ) {
if ( ! value ) {
return false;
}
const expiration = parseExpiration( value );
return (
creditcards.expiration.month.isValid( expiration.month ) &&
creditcards.expiration.year.isValid( expiration.year ) &&
! creditcards.expiration.isPast( expiration.month, expiration.year )
);
},
error: validationError,